public static RemoteCommandManagerException errorGettingHostName(Exception internalEx) { RemoteCommandManagerException ex; Object[] args = { }; ex = new RemoteCommandManagerException(ExceptionMessageGenerator.buildMessage(RemoteCommandManagerException.class, ERROR_GETTING_HOST_NAME, args)); ex.setErrorCode(ERROR_GETTING_HOST_NAME); if (internalEx != null) { ex.setInternalException(internalEx); } return ex; }
/** * ADVANCED: * Return the default local URL for JNDI lookups */ public String getDefaultLocalUrl() { try { // Look up the local host name and paste it in a default URL String localHost = InetAddress.getLocalHost().getHostName(); return "iiop://" + localHost + ":" + DEFAULT_URL_PORT; } catch (IOException exception) { throw RemoteCommandManagerException.errorGettingHostName(exception); } }
public static RemoteCommandManagerException errorGettingServerPlatform() { Object[] args = { }; RemoteCommandManagerException ex = new RemoteCommandManagerException(ExceptionMessageGenerator.buildMessage(RemoteCommandManagerException.class, ERROR_GETTING_SERVERPLATFORM, args)); ex.setErrorCode(ERROR_GETTING_SERVERPLATFORM); return ex; }
RemoteCommandManagerException rcmException; if(isLocalConnectionBeingCreated) { rcmException = RemoteCommandManagerException.errorCreatingLocalJMSConnection(topicName, connectionFactoryName, ex); } else { rcmException = RemoteCommandManagerException.errorCreatingJMSConnection(topicName, connectionFactoryName, ex);
/** * INTERNAL: */ protected TopicConnectionFactory getTopicConnectionFactory(Context remoteHostContext) { try { return (TopicConnectionFactory)remoteHostContext.lookup(connectionFactoryName); } catch (NamingException e) { RemoteCommandManagerException rcmException = RemoteCommandManagerException.errorLookingUpRemoteConnection(connectionFactoryName, rcm.getUrl(), e); rcm.handleException(rcmException); // If the handler hasn't thrown the exception rethrow it here - it's impossible to recover. throw rcmException; } }
try { rcm.handleException(RemoteCommandManagerException.errorJMSMessageIsNull()); RemoteCommandManagerException rcmException; if(messageIsNullException != null) { rcmException = RemoteCommandManagerException.errorReceivingJMSMessage(messageIsNullException); messageIsNullException = null; } else { rcmException = RemoteCommandManagerException.errorReceivingJMSMessage(e);
/** * INTERNAL: * Put the local command connection of this transport in JNDI and return it */ protected void createLocalConnectionInJNDI() { try { // Register the remote connection in JNDI naming service RMIRemoteCommandConnection remoteConnectionObject; if (this.isRMIOverIIOP()) { remoteConnectionObject = new org.eclipse.persistence.internal.sessions.coordination.rmi.iiop.RMIRemoteCommandConnectionImpl(rcm); } else { remoteConnectionObject = new RMIRemoteCommandConnectionImpl(rcm); } Object[] args = { rcm.getServiceId().getId() }; rcm.logDebug("register_local_connection_in_jndi", args); getLocalHostContext().rebind(rcm.getServiceId().getId(), remoteConnectionObject); localConnection = new RMIRemoteConnection(remoteConnectionObject); } catch (Exception exception) { rcm.handleException(RemoteCommandManagerException.errorBindingConnection(rcm.getServiceId().toString(), exception)); } }
protected EntityCacheConnection createConnection() throws RemoteCommandManagerException { try { ClusterManagerAPI clusterManager = AppBeans.get(ClusterManagerAPI.class); return new EntityCacheConnection(this.rcm, clusterManager); } catch (Exception ex) { throw new RemoteCommandManagerException(ex.getMessage()); } }
/** * INTERNAL: * Call this message in case there is failure to extract the object * (to be passed to processReceivedObject) from the message. * Pass to this method debugInfo created by logDebugOnReceiveMessage method. * This method is used by local (listening) connection only. */ protected void failDeserializeMessage(String messageId, Exception exception) { try { rcm.handleException(RemoteCommandManagerException.errorDeserializeRemoteCommand(toString(), messageId, exception)); } catch (Exception ex) { // User had a chance to handle the exception. // The method is called by a listener thread - no one could catch this exception. } }
/** * INTERNAL: * Return the serverPlatform that identifies the application server */ public ServerPlatform getServerPlatform() { if (isCommandProcessorASession()) { return ((DatabaseSessionImpl)getCommandProcessor()).getServerPlatform(); } else { if (serverPlatform != null) { return this.serverPlatform; } else { throw RemoteCommandManagerException.errorGettingServerPlatform(); } } }
/** * PUBLIC: * Initialize the remote command manager. This will also trigger the * DiscoveryManager to start establishing the EclipseLink cluster. */ public void initialize() { Object[] args = { this.getServiceId() }; logDebug("starting_rcm", args); // replace the $HOST substring of the URL with the discovered ipAddress if (getUrl().indexOf(ServiceId.HOST_TOKEN) >= 0) { try { // discover local IP address String ipAddress = InetAddress.getLocalHost().getHostAddress(); replaceLocalHostIPAddress(ipAddress); } catch (Exception ex) { // catch different exceptions that are due to security or IP address of a host could not be determined. // i.e. java.lang.SecurityException or java.net.UnknownHostException throw RemoteCommandManagerException.errorDiscoveringLocalHostIPAddress(ex); } } isStopped = false; if(discoveryManager != null) { discoveryManager.startDiscovery(); } else { transportManager.createConnections(); } }
public static RemoteCommandManagerException errorJMSMessageIsNull() { Object[] args = { }; RemoteCommandManagerException ex = new RemoteCommandManagerException(ExceptionMessageGenerator.buildMessage(RemoteCommandManagerException.class, ERROR_RECEIVED_JMS_MESSAGE_IS_NULL, args)); ex.setErrorCode(ERROR_RECEIVED_JMS_MESSAGE_IS_NULL); return ex; }
RemoteCommandManagerException rcmException; if(isLocalConnectionBeingCreated) { rcmException = RemoteCommandManagerException.errorCreatingLocalJMSConnection(topicName, connectionFactoryName, ex); } else { rcmException = RemoteCommandManagerException.errorCreatingJMSConnection(topicName, connectionFactoryName, ex);
/** * INTERNAL: */ protected Topic getTopic(Context remoteHostContext) { try { return (Topic)remoteHostContext.lookup(topicName); } catch (NamingException e) { RemoteCommandManagerException rcmException = RemoteCommandManagerException.errorLookingUpRemoteConnection(topicName, rcm.getUrl(), e); rcm.handleException(rcmException); // If the handler hasn't thrown the exception rethrow it here - it's impossible to recover. throw rcmException; } }
try { rcm.handleException(RemoteCommandManagerException.errorJMSMessageIsNull()); RemoteCommandManagerException rcmException; if(messageIsNullException != null) { rcmException = RemoteCommandManagerException.errorReceivingJMSMessage(messageIsNullException); messageIsNullException = null; } else { rcmException = RemoteCommandManagerException.errorReceivingJMSMessage(e);
/** * INTERNAL: * Put the local command connection of this transport in the Registry and return it */ protected RemoteConnection createLocalConnectionInRegistry() { String fullURL = formatURLforRegistry(rcm.getServiceId().getURL(), rcm.getServiceId().getId()); try { // Register the remote connection in RMI Registry naming service RMIRemoteCommandConnectionImpl remoteConnectionObject = new RMIRemoteCommandConnectionImpl(rcm); Object[] args = { fullURL }; rcm.logDebug("register_local_connection_in_registry", args); Naming.rebind(fullURL, remoteConnectionObject); localConnection = new RMIRemoteConnection(remoteConnectionObject); } catch (Exception exception) { rcm.handleException(RemoteCommandManagerException.errorBindingConnection(fullURL, exception)); } return localConnection; }
/** * INTERNAL: * Call this message in case there is failure to extract the object * (to be passed to processReceivedObject) from the message. * Pass to this method debugInfo created by logDebugOnReceiveMessage method. * This method is used by local (listening) connection only. */ protected void failDeserializeMessage(String messageId, Exception exception) { try { rcm.handleException(RemoteCommandManagerException.errorDeserializeRemoteCommand(toString(), messageId, exception)); } catch (Exception ex) { // User had a chance to handle the exception. // The method is called by a listener thread - no one could catch this exception. } }
/** * INTERNAL: * Return the serverPlatform that identifies the application server */ public ServerPlatform getServerPlatform() { if (isCommandProcessorASession()) { return ((DatabaseSessionImpl)getCommandProcessor()).getServerPlatform(); } else { if (serverPlatform != null) { return this.serverPlatform; } else { throw RemoteCommandManagerException.errorGettingServerPlatform(); } } }
throw RemoteCommandManagerException.errorDiscoveringLocalHostIPAddress(ex);
public static RemoteCommandManagerException errorCreatingJMSConnection(String topicName, String topicFactory, Throwable internalEx) { Object[] args = { topicName, topicFactory }; RemoteCommandManagerException ex = new RemoteCommandManagerException(ExceptionMessageGenerator.buildMessage(RemoteCommandManagerException.class, ERROR_CREATING_JMS_CONNECTION, args)); ex.setErrorCode(ERROR_CREATING_JMS_CONNECTION); if (internalEx != null) { ex.setInternalException(internalEx); } return ex; }