public static CommunicationException errorSendingConnectionService(String serviceName, Exception exception) { Object[] args = { serviceName }; CommunicationException communicationException = new CommunicationException(ExceptionMessageGenerator.buildMessage(CommunicationException.class, ERROR_SENDING_CONNECTION_SERVICE, args), exception); communicationException.setErrorCode(ERROR_SENDING_CONNECTION_SERVICE); return communicationException; }
/** * INTERNAL: * Return the changes to be applied */ public UnitOfWorkChangeSet getChangeSet(AbstractSession session) { if ((changeSet == null) && (changeSetBytes != null)) { try { changeSet = new UnitOfWorkChangeSet(changeSetBytes, session); } catch (java.io.IOException exception) { throw CommunicationException.unableToPropagateChanges(getServiceId().toString(), exception); } catch (ClassNotFoundException exception) { throw CommunicationException.unableToPropagateChanges(getServiceId().toString(), exception); } } return changeSet; }
/** * INTERNAL: * Rollback a transaction on the database. */ public void rollbackTransaction() { try { Transporter transporter = getRemoteSessionController().rollbackTransaction(); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } } catch (RemoteException exception) { throw CommunicationException.errorInInvocation(exception); } }
/** * INTERNAL: * Publish the remote command. The result of execution is returned. * This method is used only by external (publishing) connection. */ public Object executeCommand(byte[] command) throws CommunicationException { if (isActive()) { try { return executeCommandInternal(command); } catch (Exception exception) { // Note that there is no need to removeConnection here - it's removed by the calling method: // org.eclipse.persistence.internal.sessions.coordination.CommandPropagator.propagateCommand. // This method catches CommunicationException and processes it in handleCommunicationException method. // The latter method, in case shouldRemoveConnectionOnError==true, removes the connection; // otherwise it wraps the CommunicationException into RemoteCommandManagerException // (with errorCode RemoteCommandManagerException.ERROR_PROPAGATING_COMMAND) // and gives the use a chance to handle it - this is an opportunity for the user to // stop remote command processing. throw CommunicationException.errorSendingMessage(getServiceId().getId(), exception); } } else { rcm.logWarning("broadcast_ignored_command_while_closing_connection", getInfo()); return null; } }
/** * INTERNAL: * Add a remote Connection to a remote service. */ public void addConnectionToExternalService(RemoteConnection connection) { if (connection == null) { return; } try { connectBackToRemote(connection); connectionsToExternalServices.put(connection.getServiceId().getId(), connection); Object[] args = { connection.getServiceId() }; rcm.logDebug("received_connection_from", args); } catch (Exception exception) { try { rcm.handleException(CommunicationException.errorSendingConnectionService(connection.toString(), exception)); } catch (RuntimeException reThrownException) { Object[] args = { connection.getServiceId(), reThrownException }; rcm.logWarning("problem_adding_connection", args); if (!shouldRemoveConnectionOnError) { throw reThrownException; } } } }
Object[] args = { conn.getServiceId(), comEx.getInternalException() }; rcm.logWarning("drop_connection_on_error", args); rcm.getTransportManager().removeConnectionToExternalService(conn); rcm.logWarning("failed_command_propagation", args); RemoteCommandManagerException rcmException = RemoteCommandManagerException.unableToPropagateCommand(conn.toString(), comEx.getInternalException()); try { rcm.handleException(rcmException);
/** * INTERNAL: * Begin a transaction on the database. */ public void beginTransaction() { try { Transporter transporter = getRemoteSessionController().beginTransaction(); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } } catch (RemoteException exception) { throw CommunicationException.errorInInvocation(exception); } }
/** * INTERNAL: * Publish the remote command. The result of execution is returned. * This method is used only by external (publishing) connection. */ public Object executeCommand(Command command) throws CommunicationException { if(isActive()) { try { return executeCommandInternal(command); } catch (Exception exception) { // Note that there is no need to removeConnection here - it's removed by the calling method: // org.eclipse.persistence.internal.sessions.coordination.CommandPropagator.propagateCommand. // This method catches CommunicationException and processes it in handleCommunicationException method. // The latter method, in case shouldRemoveConnectionOnError==true, removes the connection; // otherwise it wraps the CommunicationException into RemoteCommandManagerException // (with erroCode RemoteCommandManagerException.ERROR_PROPAGATING_COMMAND) // and gives the use a chance to handle it - this is an opportunity for the user to // stop remote command processing. throw CommunicationException.errorSendingMessage(getServiceId().getId(), exception); } } else { rcm.logWarning("broadcast_ignored_command_while_closing_connection", getInfo()); return null; } }
/** * INTERNAL: * Add a remote Connection to a remote service. */ public void addConnectionToExternalService(RemoteConnection connection) { if (connection == null) { return; } try { connectBackToRemote(connection); connectionsToExternalServices.put(connection.getServiceId().getId(), connection); Object[] args = { connection.getServiceId() }; rcm.logDebug("received_connection_from", args); } catch (Exception exception) { try { rcm.handleException(CommunicationException.errorSendingConnectionService(connection.toString(), exception)); } catch (RuntimeException reThrownException) { Object[] args = { connection.getServiceId(), reThrownException }; rcm.logWarning("problem_adding_connection", args); if (!shouldRemoveConnectionOnError) { throw reThrownException; } } } }
Object[] args = { conn.getServiceId(), comEx.getInternalException() }; rcm.logWarning("drop_connection_on_error", args); rcm.getTransportManager().removeConnectionToExternalService(conn); rcm.logWarning("failed_command_propagation", args); RemoteCommandManagerException rcmException = RemoteCommandManagerException.unableToPropagateCommand(conn.toString(), comEx.getInternalException()); try { rcm.handleException(rcmException);
/** * INTERNAL: * Commit a transaction on the database. */ public void commitTransaction() { try { Transporter transporter = getRemoteSessionController().commitTransaction(); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } } catch (RemoteException exception) { throw CommunicationException.errorInInvocation(exception); } }
public static CommunicationException unableToConnect(String serviceName, Exception exception) { Object[] args = { serviceName }; CommunicationException communicationException = new CommunicationException(ExceptionMessageGenerator.buildMessage(CommunicationException.class, UNABLE_TO_CONNECT, args), exception); communicationException.setErrorCode(UNABLE_TO_CONNECT); return communicationException; }
/** * INTERNAL: * Publish the remote command. The result of execution is returned. * This method is used only by external (publishing) connection. */ public Object executeCommand(Command command) throws CommunicationException { if (isActive()) { try { return executeCommandInternal(command); } catch (Exception exception) { // Note that there is no need to removeConnection here - it's removed by the calling method: // org.eclipse.persistence.internal.sessions.coordination.CommandPropagator.propagateCommand. // This method catches CommunicationException and processes it in handleCommunicationException method. // The latter method, in case shouldRemoveConnectionOnError==true, removes the connection; // otherwise it wraps the CommunicationException into RemoteCommandManagerException // (with errorCode RemoteCommandManagerException.ERROR_PROPAGATING_COMMAND) // and gives the use a chance to handle it - this is an opportunity for the user to // stop remote command processing. throw CommunicationException.errorSendingMessage(getServiceId().getId(), exception); } } else { rcm.logWarning("broadcast_ignored_command_while_closing_connection", getInfo()); return null; } }
/** * INTERNAL: * Add a remote Connection to a remote service. */ public void addConnectionToExternalService(RemoteConnection connection) { if (connection == null) { return; } try { connectBackToRemote(connection); connectionsToExternalServices.put(connection.getServiceId().getId(), connection); Object[] args = { connection.getServiceId() }; rcm.logDebug("received_connection_from", args); } catch (Exception exception) { try { rcm.handleException(CommunicationException.errorSendingConnectionService(connection.toString(), exception)); } catch (RuntimeException reThrownException) { Object[] args = { connection.getServiceId(), reThrownException }; rcm.logWarning("problem_adding_connection", args); if (!shouldRemoveConnectionOnError) { throw reThrownException; } } } }
Object[] args = { conn.getServiceId(), comEx.getInternalException() }; rcm.logWarning("drop_connection_on_error", args); rcm.getTransportManager().removeConnectionToExternalService(conn); rcm.logWarning("failed_command_propagation", args); RemoteCommandManagerException rcmException = RemoteCommandManagerException.unableToPropagateCommand(conn.toString(), comEx.getInternalException()); try { rcm.handleException(rcmException);
/** * ADVANCED: * Set an object to be invalid in the cache. * @param invalidateCluster if true the invalidation will be broadcast to each server in the cluster. */ public void invalidateObject(Vector primaryKey, Class theClass, boolean invalidateCluster) { ClassDescriptor descriptor = getSession().getDescriptor(theClass); //forward the call to getCacheKeyForObject locally in case subclasses overload CacheKey key = this.getCacheKeyForObjectForLock(primaryKey, theClass, descriptor); if (key != null) { key.setInvalidationState(CacheKey.CACHE_KEY_INVALID); } if (invalidateCluster) { CommandManager rcm = getSession().getCommandManager(); if (rcm != null) { UnitOfWorkChangeSet changeSet = new UnitOfWorkChangeSet(getSession()); ObjectChangeSet objectChangeSet = new ObjectChangeSet(primaryKey, descriptor, null, changeSet, false); objectChangeSet.setSynchronizationType(ClassDescriptor.INVALIDATE_CHANGED_OBJECTS); changeSet.getAllChangeSets().put(objectChangeSet, objectChangeSet); MergeChangeSetCommand command = new MergeChangeSetCommand(); command.setChangeSet(changeSet); try { command.convertChangeSetToByteArray(getSession()); } catch (java.io.IOException exception) { throw CommunicationException.unableToPropagateChanges(command.getServiceId().getId(), exception); } rcm.propagateCommand(command); } } }
/** * INTERNAL: * Begin an early unit of work transaction. */ public void beginEarlyTransaction() { try { Transporter transporter = getRemoteSessionController().beginEarlyTransaction(); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } } catch (RemoteException exception) { throw CommunicationException.errorInInvocation(exception); } }
public static CommunicationException errorSendingConnectionService(String serviceName, Exception exception) { Object[] args = { serviceName }; CommunicationException communicationException = new CommunicationException(ExceptionMessageGenerator.buildMessage(CommunicationException.class, ERROR_SENDING_CONNECTION_SERVICE, args), exception); communicationException.setErrorCode(ERROR_SENDING_CONNECTION_SERVICE); return communicationException; }
/** * INTERNAL: * Publish the remote command. The result of execution is returned. * This method is used only by external (publishing) connection. */ public Object executeCommand(Command command) throws CommunicationException { if (isActive()) { try { return executeCommandInternal(command); } catch (Exception exception) { // Note that there is no need to removeConnection here - it's removed by the calling method: // org.eclipse.persistence.internal.sessions.coordination.CommandPropagator.propagateCommand. // This method catches CommunicationException and processes it in handleCommunicationException method. // The latter method, in case shouldRemoveConnectionOnError==true, removes the connection; // otherwise it wraps the CommunicationException into RemoteCommandManagerException // (with errorCode RemoteCommandManagerException.ERROR_PROPAGATING_COMMAND) // and gives the use a chance to handle it - this is an opportunity for the user to // stop remote command processing. throw CommunicationException.errorSendingMessage(getServiceId().getId(), exception); } } else { rcm.logWarning("broadcast_ignored_command_while_closing_connection", getInfo()); return null; } }
hasData = command.convertChangeSetToByteArray(this); } catch (java.io.IOException exception) { throw CommunicationException.unableToPropagateChanges("", exception);