AgentServer.getTransaction().commit(true);
AgentServer.getTransaction().commit(true);
/** {@inheritDoc} */ public void deleteServer(String name) { synchronized (servers) { JMSModule cnx = servers.remove(name); if (cnx != null) { cnx.stopLiveConnection(); try { if (Thread.currentThread() != AgentServer.getEngineThread()) { AgentServer.getTransaction().begin(); } AgentServer.getTransaction().save((HashMap) servers, SAVE_FILE_NAME); if (Thread.currentThread() != AgentServer.getEngineThread()) { AgentServer.getTransaction().commit(true); } } catch (IOException exc) { logger.log(BasicLevel.ERROR, "Error while deleting server " + name, exc); } } } }
/** {@inheritDoc} */ public void addServer(String cnxFactoryName, String jndiFactoryClass, String jndiUrl, String user, String password, String clientID) { synchronized (servers) { if (!servers.containsKey(cnxFactoryName)) { JMSModule cnx = new JMSModule(cnxFactoryName, jndiFactoryClass, jndiUrl, user, password, clientID); cnx.startLiveConnection(); servers.put(cnxFactoryName, cnx); } } try { if (Thread.currentThread() != AgentServer.getEngineThread()) { AgentServer.getTransaction().begin(); } AgentServer.getTransaction().save((HashMap) servers, SAVE_FILE_NAME); if (Thread.currentThread() != AgentServer.getEngineThread()) { AgentServer.getTransaction().commit(true); } } catch (IOException exc) { logger.log(BasicLevel.ERROR, "Error while persisting new connection " + cnxFactoryName, exc); } }
AgentServer.getTransaction().commit(true);
/** * Saves object in persistent storage. */ static void save() throws IOException { AgentServer.getTransaction().save(manager, "serviceManager"); // with OSGi the service start asynchronously, // and perhaps without running transaction. AgentServer.getTransaction().begin(); AgentServer.getTransaction().commit(true); if (xlogmon.isLoggable(BasicLevel.DEBUG)) xlogmon.log(BasicLevel.DEBUG, getName() + " service manager saved."); }
/** * Saves object in persistent storage. */ static void save() throws IOException { AgentServer.getTransaction().save(manager, "serviceManager"); // with OSGi the service start asynchronously, // and perhaps without running transaction. AgentServer.getTransaction().begin(); AgentServer.getTransaction().commit(true); if (xlogmon.isLoggable(BasicLevel.DEBUG)) xlogmon.log(BasicLevel.DEBUG, getName() + " service manager saved."); }
void receiveFromJGroups(Message msg) throws Exception { if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, getName() + " receiveFromJGroups(" + msg + ")"); AgentServer.getTransaction().begin(); stamp(msg); msg.save(); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG,getName() + " receiveFromJGroups qin.size() = " + qin.size() + ", qinFromExt.size() = " + qinFromExt.size()); AgentServer.getTransaction().commit(false); qinFromExt.addElement(msg); postFromExt(); AgentServer.getTransaction().release(); }
/** * Removes the expired message, if needed an ExpiredNot is sent to the * deadNotificationAgentId specified. * * @param msg * The message to remove. */ private void removeExpired(MessageSoftRef msgRef) { if (msgRef.getDeadNotAgentId() != null) { Message msg = msgRef.loadMessage(); removeExpired(msg); } else { try { AgentServer.getTransaction().begin(); msgRef.delete(); AgentServer.getTransaction().commit(true); } catch (Exception exc) { logmon.log(BasicLevel.ERROR, "exception when deleting expired msg#" + msgRef.getStamp(), exc); } } }
/** * Removes the expired message, if needed an ExpiredNot is sent to the * deadNotificationAgentId specified. * * @param msg * The message to remove. */ private void removeExpired(MessageSoftRef msgRef) { if (msgRef.getDeadNotAgentId() != null) { Message msg = msgRef.loadMessage(); removeExpired(msg); } else { try { AgentServer.getTransaction().begin(); msgRef.delete(); AgentServer.getTransaction().commit(true); } catch (Exception exc) { logmon.log(BasicLevel.ERROR, "exception when deleting expired msg#" + msgRef.getStamp(), exc); } } }
void ackMsg(JGroupsAckMsg ack) { try { AgentServer.getTransaction().begin(); // Deletes the processed notification qout.remove(ack.getStamp()); ack.delete(); AgentServer.getTransaction().commit(true); if (this.logmon.isLoggable(BasicLevel.DEBUG)) this.logmon.log(BasicLevel.DEBUG, this.getName() + ", ackMsg(...) done."); } catch (Exception exc) { this.logmon.log(BasicLevel.FATAL, this.getName() + ", ackMsg unrecoverable exception", exc); } }
/** * Removes all messages in sendList previous to the ack'ed one. * Be careful, messages in sendList are not always in stamp order. * Its method should not be synchronized, it scans the list from * begin to end, and it removes always the first element. Other * methods using sendList just adds element at the end. */ final private void doAck(int ack) throws IOException { Message msg = null; try { // Suppress the acknowledged notification from waiting list, // and deletes it. msg = sendlist.removeMessage(ack); AgentServer.getTransaction().begin(); msg.delete(); msg.free(); AgentServer.getTransaction().commit(true); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, getName() + ", remove msg#" + msg.getStamp()); } catch (NoSuchElementException exc) { logmon.log(BasicLevel.WARN, getName() + ", can't ack, unknown msg#" + ack); } }
/** * Removes all messages in sendList previous to the ack'ed one. * Be careful, messages in sendList are not always in stamp order. * Its method should not be synchronized, it scans the list from * begin to end, and it removes always the first element. Other * methods using sendList just adds element at the end. */ final private void doAck(int ack) throws IOException { Message msg = null; try { // Suppress the acknowledged notification from waiting list, // and deletes it. msg = sendlist.removeMessage(ack); AgentServer.getTransaction().begin(); msg.delete(); msg.free(); AgentServer.getTransaction().commit(true); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, getName() + ", remove msg#" + msg.getStamp()); } catch (NoSuchElementException exc) { logmon.log(BasicLevel.WARN, getName() + ", can't ack, unknown msg#" + ack); } }
new ExceptionNotification(msg.to, msg.not, exc)); dispatch(); AgentServer.getTransaction().commit(false);
new ExceptionNotification(msg.to, msg.not, exc)); dispatch(); AgentServer.getTransaction().commit(false);
msg.free(); AgentServer.getTransaction().commit(true); } catch (Exception exc) { logmon.log(BasicLevel.ERROR, "exception in removeExpired msg#" + msg.getStamp(), exc);
msg.free(); AgentServer.getTransaction().commit(true); } catch (Exception exc) { logmon.log(BasicLevel.ERROR, "exception in removeExpired msg#" + msg.getStamp(), exc);
protected int handle(Message msgout, NetworkInputStream nis) throws Exception { int ack = nis.getAckStamp(); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, this.getName() + ", handle: " + msgout + ", ack=" + ack); if ((msgout != null) && (msgout.stamp == ack)) { AgentServer.getTransaction().begin(); // Suppress the processed notification from message queue, // and deletes it. qout.removeMessage(msgout); msgout.delete(); msgout.free(); AgentServer.getTransaction().commit(true); } Message msg = nis.getMessage(); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, this.getName() + ", get: " + msg); if (msg != null) { ack = msg.stamp; testBootTS(msg.getSource(), nis.getBootTS()); deliver(msg); return ack; } return -1; }
AgentServer.getTransaction().commit(false);
protected int handle(Message msgout, NetworkInputStream nis) throws Exception { int ack = nis.getAckStamp(); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, this.getName() + ", handle: " + msgout + ", ack=" + ack); if ((msgout != null) && (msgout.stamp == ack)) { AgentServer.getTransaction().begin(); // Suppress the processed notification from message queue, // and deletes it. qout.removeMessage(msgout); msgout.delete(); msgout.free(); AgentServer.getTransaction().commit(true); } Message msg = nis.getMessage(); if (logmon.isLoggable(BasicLevel.DEBUG)) logmon.log(BasicLevel.DEBUG, this.getName() + ", get: " + msg); if (msg != null) { ack = msg.stamp; testBootTS(msg.getSource(), nis.getBootTS()); deliver(msg); return ack; } return -1; }