本文整理汇总了Java中org.apache.activemq.artemis.api.core.ActiveMQException.getType方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQException.getType方法的具体用法?Java ActiveMQException.getType怎么用?Java ActiveMQException.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.artemis.api.core.ActiveMQException
的用法示例。
在下文中一共展示了ActiveMQException.getType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSessionContext
import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public SessionContext createSessionContext(String name,
String username,
String password,
boolean xa,
boolean autoCommitSends,
boolean autoCommitAcks,
boolean preAcknowledge,
int minLargeMessageSize,
int confirmationWindowSize) throws ActiveMQException {
for (Version clientVersion : VersionLoader.getClientVersions()) {
try {
return createSessionContext(clientVersion, name, username, password, xa, autoCommitSends, autoCommitAcks, preAcknowledge, minLargeMessageSize, confirmationWindowSize);
} catch (ActiveMQException e) {
if (e.getType() != ActiveMQExceptionType.INCOMPATIBLE_CLIENT_SERVER_VERSIONS) {
throw e;
}
}
}
connection.destroy();
throw new ActiveMQException(ActiveMQExceptionType.INCOMPATIBLE_CLIENT_SERVER_VERSIONS);
}
示例2: intercept
import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException {
if (packet.getType() == PacketImpl.EXCEPTION) {
ActiveMQExceptionMessage msg = (ActiveMQExceptionMessage) packet;
final ActiveMQException exception = msg.getException();
if (exception.getType() == ActiveMQExceptionType.CLUSTER_SECURITY_EXCEPTION) {
ActiveMQServerLogger.LOGGER.clusterManagerAuthenticationError(exception.getMessage());
executor.execute(new Runnable() {
@Override
public void run() {
try {
manager.stop();
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.failedToStopClusterManager(e);
}
}
});
}
}
return true;
}
示例3: connectionFailed
import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public void connectionFailed(final ActiveMQException me, boolean failedOver) {
if (me.getType() == ActiveMQExceptionType.DISCONNECTED) {
if (ActiveMQXARecoveryLogger.LOGGER.isDebugEnabled()) {
ActiveMQXARecoveryLogger.LOGGER.debug("being disconnected for server shutdown", me);
}
} else {
ActiveMQXARecoveryLogger.LOGGER.xaRecoverConnectionError(me, csf);
}
close();
}
示例4: recreateSession
import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public void recreateSession(final String username,
final String password,
final int minLargeMessageSize,
final boolean xa,
final boolean autoCommitSends,
final boolean autoCommitAcks,
final boolean preAcknowledge) throws ActiveMQException {
Packet createRequest = newCreateSession(username, password, minLargeMessageSize, xa, autoCommitSends, autoCommitAcks, preAcknowledge);
boolean retry;
do {
try {
getCreateChannel().sendBlocking(createRequest, PacketImpl.CREATESESSION_RESP);
retry = false;
} catch (ActiveMQException e) {
// the session was created while its server was starting, retry it:
if (e.getType() == ActiveMQExceptionType.SESSION_CREATION_REJECTED) {
ActiveMQClientLogger.LOGGER.retryCreateSessionSeverStarting(name);
retry = true;
// sleep a little bit to avoid spinning too much
try {
Thread.sleep(10);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw e;
}
} else {
throw e;
}
}
}
while (retry && !session.isClosing());
}
示例5: connectionFailed
import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public void connectionFailed(final ActiveMQException me, boolean failedOver) {
if (me.getType() == ActiveMQExceptionType.DISCONNECTED) {
// Backup has shut down - no need to log a stack trace
ActiveMQServerLogger.LOGGER.replicationStopOnBackupShutdown();
} else {
ActiveMQServerLogger.LOGGER.replicationStopOnBackupFail(me);
}
try {
stop();
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.errorStoppingReplication(e);
}
}
示例6: onActiveMQExceptionWhileHandlePacket
import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
private static Packet onActiveMQExceptionWhileHandlePacket(ActiveMQException e,
boolean requiresResponse,
Packet response) {
if (requiresResponse) {
logger.debug("Sending exception to client", e);
response = new ActiveMQExceptionMessage(e);
} else {
if (e.getType() == ActiveMQExceptionType.QUEUE_EXISTS) {
logger.debug("Caught exception", e);
} else {
ActiveMQServerLogger.LOGGER.caughtException(e);
}
}
return response;
}
示例7: validateClientID
import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
private void validateClientID(ClientSession validateSession, String clientID) throws InvalidClientIDException {
try {
validateSession.addUniqueMetaData(ClientSession.JMS_SESSION_CLIENT_ID_PROPERTY, clientID);
} catch (ActiveMQException e) {
if (e.getType() == ActiveMQExceptionType.DUPLICATE_METADATA) {
throw new InvalidClientIDException("clientID=" + clientID + " was already set into another connection");
}
}
}
示例8: commit
import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public void commit(boolean block) throws ActiveMQException {
checkClosed();
if (logger.isTraceEnabled()) {
logger.trace("Sending commit");
}
/*
* we have failed over since any work was done so we should rollback
* */
if (rollbackOnly) {
rollbackOnFailover(true);
}
flushAcks();
/*
* if we have failed over whilst flushing the acks then we should rollback and throw exception before attempting to
* commit as committing might actually commit something but we we wouldn't know and rollback after the commit
* */
if (rollbackOnly) {
rollbackOnFailover(true);
}
try {
sessionContext.simpleCommit(block);
} catch (ActiveMQException e) {
if (e.getType() == ActiveMQExceptionType.UNBLOCKED || e.getType() == ActiveMQExceptionType.CONNECTION_TIMEDOUT || rollbackOnly) {
// The call to commit was unlocked on failover, we therefore rollback the tx,
// and throw a transaction rolled back exception instead
//or
//if we have been set to rollbackonly then we have probably failed over and don't know if the tx has committed
rollbackOnFailover(false);
} else {
throw e;
}
}
//oops, we have failed over during the commit and don't know what happened
if (rollbackOnly) {
rollbackOnFailover(false);
}
workDone = false;
}
示例9: createSessionFactory
import org.apache.activemq.artemis.api.core.ActiveMQException; //导入方法依赖的package包/类
@Override
public ClientSessionFactory createSessionFactory() throws ActiveMQException {
assertOpen();
initialise();
if (this.getNumInitialConnectors() == 0 && discoveryGroup != null) {
// Wait for an initial broadcast to give us at least one node in the cluster
long timeout = clusterConnection ? 0 : discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout();
boolean ok = discoveryGroup.waitForBroadcast(timeout);
if (!ok) {
throw ActiveMQClientMessageBundle.BUNDLE.connectionTimedOutInInitialBroadcast();
}
}
ClientSessionFactoryInternal factory = null;
synchronized (this) {
boolean retry;
int attempts = 0;
do {
retry = false;
TransportConfiguration tc = selectConnector();
if (tc == null) {
throw ActiveMQClientMessageBundle.BUNDLE.noTCForSessionFactory();
}
// try each factory in the list until we find one which works
try {
factory = new ClientSessionFactoryImpl(this, tc, callTimeout, callFailoverTimeout, clientFailureCheckPeriod, connectionTTL, retryInterval, retryIntervalMultiplier, maxRetryInterval, reconnectAttempts, threadPool, scheduledThreadPool, incomingInterceptors, outgoingInterceptors);
try {
addToConnecting(factory);
factory.connect(initialConnectAttempts, failoverOnInitialConnection);
} finally {
removeFromConnecting(factory);
}
} catch (ActiveMQException e) {
factory.close();
if (e.getType() == ActiveMQExceptionType.NOT_CONNECTED) {
attempts++;
synchronized (topologyArrayGuard) {
if (topologyArray != null && attempts == topologyArray.length) {
throw ActiveMQClientMessageBundle.BUNDLE.cannotConnectToServers();
}
if (topologyArray == null && attempts == this.getNumInitialConnectors()) {
throw ActiveMQClientMessageBundle.BUNDLE.cannotConnectToServers();
}
}
retry = true;
} else {
throw e;
}
}
}
while (retry);
}
// ATM topology is never != null. Checking here just to be consistent with
// how the sendSubscription happens.
// in case this ever changes.
if (topology != null && !factory.waitForTopology(callTimeout, TimeUnit.MILLISECONDS)) {
factory.cleanup();
throw ActiveMQClientMessageBundle.BUNDLE.connectionTimedOutOnReceiveTopology(discoveryGroup);
}
addFactory(factory);
return factory;
}