use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.
the class Agent method getDefaultJMXUrlPathBase.
public String getDefaultJMXUrlPathBase() throws BrokerException {
MQAddress addr = Globals.getMQAddress();
String rmiRegHostName, brokerHostName, ret = null;
int brokerPort, rmiRegistryPort;
if (addr == null) {
return (null);
}
/*
* These other methods work too. Would be good if we could obtain a fully qualified hostname i.e. with domain.
* brokerHostName = Globals.getBrokerHostName(); brokerHostName = Globals.getBrokerInetAddress().getCanonicalHostName();
*/
brokerHostName = addr.getHostName();
rmiRegHostName = Globals.getJMXHostname();
brokerPort = addr.getPort();
rmiRegistryPort = getRmiRegistryPort();
/*
* rmiRegHostName can be null if imq.jmx.hostname or imq.hostname is not set.
*/
if (rmiRegHostName == null) {
rmiRegHostName = brokerHostName;
} else {
try {
rmiRegHostName = MQAddress.getMQAddress(rmiRegHostName, rmiRegistryPort).getHostName();
} catch (MalformedURLException e) {
throw new BrokerException(e.toString(), e);
}
}
/*
* The default urlpath base is: /jndi/rmi://<brokerhost>:<rmiport>/<brokerhost>/<brokerport>/ e.g
* /jndi/rmi://myhost:1099/myhost/7676/
*/
ret = "/jndi/rmi://" + rmiRegHostName + ":" + Integer.toString(rmiRegistryPort) + "/" + brokerHostName + "/" + Integer.toString(brokerPort) + "/";
return (ret);
}
use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.
the class ConnectorServerManager method initConfiguredConnectorServers.
/*
* Initialize connectors table with list specified by properties: imq.jmx.connector.list all connectors
* imq.jmx.connector.activelist connectors to be made active
*/
public void initConfiguredConnectorServers() throws BrokerException {
List connectorServers = getAllJMXConnectorNames();
Set s = connectors.keySet();
/*
* Empty out existing connectors in hashtable
*/
Iterator itr = s.iterator();
while (itr.hasNext()) {
String name = (String) itr.next();
try {
/*
* stop/remove connector
*/
remove(name);
} catch (Exception e) {
logger.log(Logger.WARNING, rb.getString(rb.W_JMX_REMOVE_CONNECTOR_EXCEPTION, name), e);
}
}
for (int i = 0; i < connectorServers.size(); i++) {
String name = (String) connectorServers.get(i);
add(name, connectorIsConfiguredActive(name));
}
}
use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.
the class ConnectorServerManager method start.
/**
* Start one connector server
*/
public void start(String name) throws IOException, BrokerException {
ConnectorServerInfo csInfo;
csInfo = (ConnectorServerInfo) connectors.get(name);
if (csInfo == null) {
throw new BrokerException(rb.getString(rb.W_JMX_START_CONNECTOR_NON_EXISTANT, name));
}
try {
csInfo.start();
HashMap map = new HashMap();
map.put("url", csInfo.getJMXServiceURL().toString());
Globals.getPortMapper().addService(name, csInfo.getProtocol(), "JMX", csInfo.getPort(), map);
logger.log(Logger.INFO, rb.getKString(rb.I_JMX_CONNECTOR_STARTED, name, csInfo.getJMXServiceURL()));
} catch (IOException e) {
logger.logStack(Logger.WARNING, rb.getKString(rb.W_JMX_CONNECTOR_START_EXCEPTION, name), e);
throw (e);
}
}
use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.
the class BrokerConfig method quiesce.
public void quiesce() throws MBeanException {
BrokerStateHandler bsh = Globals.getBrokerStateHandler();
logger.log(Logger.INFO, "Quiesce request received by MBean " + getMBeanName());
try {
bsh.quiesce();
} catch (BrokerException e) {
handleOperationException(BrokerOperations.QUIESCE, e);
}
}
use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.
the class TransactionInformation method addConsumedMessage.
public synchronized void addConsumedMessage(SysMessageID sysid, ConsumerUID id, ConsumerUID sid) throws BrokerException {
// first check if we have exceeded our maximum message count per txn
if (consumed.size() < TransactionList.defaultConsumerMaxMsgCnt) {
List l = (List) consumed.get(sysid);
if (l == null) {
l = new ArrayList();
consumed.put(sysid, l);
} else if (l.contains(id)) {
throw new TransactionAckExistException(Globals.getBrokerResources().getKString(Globals.getBrokerResources().X_ACK_EXISTS_IN_TRANSACTION, "[" + sysid + ":" + id + "," + sid + "]", tid), Status.CONFLICT);
}
l.add(id);
cuidToStored.put(id, sid);
} else {
throw new BrokerException(Globals.getBrokerResources().getKString(BrokerResources.X_TXN_CONSUMER_MAX_MESSAGE_COUNT_EXCEEDED, TransactionList.defaultConsumerMaxMsgCnt, tid), BrokerResources.X_TXN_CONSUMER_MAX_MESSAGE_COUNT_EXCEEDED, (Throwable) null, Status.RESOURCE_FULL);
}
}
Aggregations