@Override public long getClusterTime() { return hzInstance.getCluster().getClusterTime(); }
public long getClusterTime() { return hazelcastInstance.getCluster().getClusterTime(); }
public static long nextTimestamp(final HazelcastInstance instance) { if (instance == null) { throw new RuntimeException("No Hazelcast instance!"); } else if (instance.getCluster() == null) { throw new RuntimeException("Hazelcast instance has no cluster!"); } // System time in ms. return instance.getCluster().getClusterTime(); }
public static long nextTimestamp(final HazelcastInstance instance) { if (instance == null) { throw new RuntimeException("No Hazelcast instance!"); } else if (instance.getCluster() == null) { throw new RuntimeException("Hazelcast instance has no cluster!"); } // System time in ms. return instance.getCluster().getClusterTime(); }
public static long nextTimestamp(HazelcastInstance instance) { if (instance == null) { throw new RuntimeException("No Hazelcast instance!"); } else if (instance.getCluster() == null) { throw new RuntimeException("Hazelcast instance has no cluster!"); } // System time in ms. return instance.getCluster().getClusterTime(); }
public static long nextTimestamp(final HazelcastInstance instance) { if (instance == null) { throw new RuntimeException("No Hazelcast instance!"); } else if (instance.getCluster() == null) { throw new RuntimeException("Hazelcast instance has no cluster!"); } // System time in ms. return instance.getCluster().getClusterTime(); }
@ManagedAnnotation("clusterTime") @ManagedDescription("Cluster-wide Time") public long getClusterTime() { return cluster.getClusterTime(); }
@ManagedAnnotation("clusterTime") @ManagedDescription("Cluster-wide Time") public long getClusterTime() { return cluster.getClusterTime(); }
private void addClient(final ClientContainer cc, final String clientId, Properties props) { HazelcastInstance hzClient = cc.hzInstance; if (cc.addClient(clientId)) { ReplicatedMap<String, Properties> clientProps = hzClient.getReplicatedMap(CN_XDM_CLIENT); HazelcastClientProxy proxy = (HazelcastClientProxy) hzClient; props.setProperty(pn_client_memberId, proxy.client.getClientClusterService().getLocalClient().getUuid()); props.setProperty(pn_client_connectedAt, new java.util.Date(proxy.getCluster().getClusterTime()).toString()); clientProps.put(clientId, props); logger.debug("addClient; got new connection for clientId: {}", clientId); } else { logger.trace("addClient; got existing connection for clientId: {}", clientId); } }
public ClusterMetadata(String name, Cluster cluster) { this.name = name; this.version = BuildInfoProvider.getBuildInfo().getJetBuildInfo().getVersion(); this.state = cluster.getClusterState(); this.clusterTime = cluster.getClusterTime(); }
@Override public long beginTransaction(TransactionIsolation txIsolation) throws BagriException { logger.trace("beginTransaction.enter; txIsolation: {}", txIsolation); long txId = thTx.get(); if (txId > TX_NO && txCache.containsKey(txId)) { throw new BagriException("nested transactions are not supported; current txId: " + txId, ecTransNoNested); } txId = txGen.next(); // TODO: do this via EntryProcessor? Transaction xTx = new Transaction(txId, cluster.getClusterTime(), 0, repo.getUserName(), txIsolation, TransactionState.started); triggerManager.applyTrigger(xTx, Order.before, Scope.begin); txCache.set(txId, xTx); thTx.set(txId); cntStarted.incrementAndGet(); triggerManager.applyTrigger(xTx, Order.after, Scope.begin); logger.trace("beginTransaction.exit; started tx: {}; returning: {}", xTx, txId); return txId; }
@Override public void rollbackTransaction(long txId) throws BagriException { logger.trace("rollbackTransaction.enter; got txId: {}", txId); // TODO: do this via EntryProcessor? Transaction xTx = txCache.get(txId); if (xTx != null) { triggerManager.applyTrigger(xTx, Order.before, Scope.rollback); xTx.finish(false, cluster.getClusterTime()); txCache.set(txId, xTx); } else { throw new BagriException("No transaction found for TXID: " + txId, ecTransNotFound); } thTx.set(TX_NO); cntRolled.incrementAndGet(); triggerManager.applyTrigger(xTx, Order.after, Scope.rollback); publishCounters(false, xTx.getDocsCreated(), xTx.getDocsUpdated(), xTx.getDocsDeleted()); cleanAffectedDocuments(xTx); logger.trace("rollbackTransaction.exit; tx: {}", xTx); }
@Override public void commitTransaction(long txId) throws BagriException { logger.trace("commitTransaction.enter; got txId: {}", txId); // TODO: do this via EntryProcessor? Transaction xTx = txCache.get(txId); if (xTx != null) { triggerManager.applyTrigger(xTx, Order.before, Scope.commit); xTx.finish(true, cluster.getClusterTime()); //txCache.delete(txId); txCache.set(txId, xTx); } else { throw new BagriException("no transaction found for TXID: " + txId, ecTransNotFound); } thTx.set(TX_NO); cntCommited.incrementAndGet(); triggerManager.applyTrigger(xTx, Order.after, Scope.commit); publishCounters(true, xTx.getDocsCreated(), xTx.getDocsUpdated(), xTx.getDocsDeleted()); cleanAffectedDocuments(xTx); logger.trace("commitTransaction.exit; tx: {}", xTx); }