@Override public void commitBindings(long txID) throws Exception { manager.commitBindings(txID); }
@Override public void remove(SimpleString groupid, SimpleString clusterName) { GroupBinding groupBinding = map.remove(groupid); List<GroupBinding> groupBindings = groupMap.get(clusterName); if (groupBindings != null && groupBinding != null) { groupBindings.remove(groupBinding); try { long tx = storageManager.generateID(); storageManager.deleteGrouping(tx, groupBinding); storageManager.commitBindings(tx); } catch (Exception e) { // nothing we can do being log ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); } } }
/** * @throws Exception */ @Override protected void doCommit() throws Exception { if (isContainsPersistent()) { storageManager.commitBindings(getID()); setState(State.COMMITTED); } }
@Override public boolean addAddressInfo(AddressInfo addressInfo) throws Exception { boolean added = reloadAddressInfo(addressInfo); if (added && storageManager != null) { long txID = storageManager.generateID(); try { storageManager.addAddressBinding(txID, addressInfo); storageManager.commitBindings(txID); } catch (Exception e) { try { storageManager.rollbackBindings(txID); } catch (Exception ignored) { } throw e; } } return added; }
storageManager.commitBindings(txID); expiredGroups = 0; txID = -1; storageManager.commitBindings(txID); } catch (Exception e) { ActiveMQServerLogger.LOGGER.unableToDeleteGroupBindings(e, SimpleString.toSimpleString("TX:" + txID));
@Override public void removeAddressInfo(final SimpleString address, final SecurityAuth auth, boolean force) throws Exception { if (auth != null) { securityStore.check(address, CheckType.DELETE_ADDRESS, auth); } AddressInfo addressInfo = getAddressInfo(address); if (postOffice.removeAddressInfo(address, force) == null) { throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(address); } long txID = storageManager.generateID(); storageManager.deleteAddressBinding(txID, addressInfo.getId()); storageManager.commitBindings(txID); pagingManager.deletePageStore(address); }
storageManager.deleteAddressBinding(txID, info.getId()); storageManager.addAddressBinding(txID, info); storageManager.commitBindings(txID); } catch (Exception e) { try {
@Override public void run() { long txID = -1; for (GroupBinding val : list) { if (val != null) { fireUnproposed(val.getGroupId()); map.remove(val.getGroupId()); sendUnproposal(val.getGroupId(), clusterName, 0); try { if (txID < 0) { txID = storageManager.generateID(); } storageManager.deleteGrouping(txID, val); } catch (Exception e) { ActiveMQServerLogger.LOGGER.unableToDeleteGroupBindings(e, val.getGroupId()); } } } if (txID >= 0) { try { storageManager.commitBindings(txID); } catch (Exception e) { ActiveMQServerLogger.LOGGER.unableToDeleteGroupBindings(e, SimpleString.toSimpleString("TX:" + txID)); } } } });
try { storageManager.updateQueueBinding(txID, queueBinding); storageManager.commitBindings(txID); } catch (Throwable throwable) { storageManager.rollback(txID);
storage.commitBindings(txid);
postOffice.addBinding(localQueueBinding); if (queue.isDurable()) { storageManager.commitBindings(txID);
final long tx = storageManager.generateID(); storageManager.deleteQueueBinding(tx, queueBindingInfo.getId()); storageManager.commitBindings(tx); continue; } else {
/** * This would force a journal duplication on bindings even with the scenario that generated fixed, * the server shouldn't hold of from starting * * @throws Exception */ @Test public void testForceDuplicationOnBindings() throws Exception { queue = server.createQueue(QUEUE, RoutingType.ANYCAST, QUEUE, null, true, false); ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, false, false); ClientProducer producer = session.createProducer(QUEUE); producer.send(session.createMessage(true)); session.commit(); long queueID = server.getStorageManager().generateID(); long txID = server.getStorageManager().generateID(); // Forcing a situation where the server would unexpectedly create a duplicated queue. The server should still start normally LocalQueueBinding newBinding = new LocalQueueBinding(QUEUE, new QueueImpl(queueID, QUEUE, QUEUE, null, null, true, false, false, null, null, null, null, null, null, null), server.getNodeID()); server.getStorageManager().addQueueBinding(txID, newBinding); server.getStorageManager().commitBindings(txID); server.stop(); // a duplicate binding would impede the server from starting server.start(); waitForServerToStart(server); server.stop(); }