use of com.hazelcast.client.spi.ClientContext in project hazelcast by hazelcast.
the class AbstractClientInternalCacheProxy method getConnectedServerVersion.
private int getConnectedServerVersion() {
ClientContext clientContext = getContext();
ClientClusterService clusterService = clientContext.getClusterService();
Address ownerConnectionAddress = clusterService.getOwnerConnectionAddress();
HazelcastClientInstanceImpl client = getClient();
ClientConnectionManager connectionManager = client.getConnectionManager();
Connection connection = connectionManager.getConnection(ownerConnectionAddress);
if (connection == null) {
logger.warning(format("No owner connection is available, " + "near cached cache %s will be started in legacy mode", name));
return UNKNOWN_HAZELCAST_VERSION;
}
return ((ClientConnection) connection).getConnectedServerVersion();
}
use of com.hazelcast.client.spi.ClientContext in project hazelcast by hazelcast.
the class ClientReplicatedMapProxy method initNearCache.
private void initNearCache() {
ClientContext context = getContext();
NearCacheConfig nearCacheConfig = context.getClientConfig().getNearCacheConfig(name);
if (nearCacheConfig == null) {
return;
}
nearCache = context.getNearCacheManager().getOrCreateNearCache(name, nearCacheConfig);
if (nearCache.isInvalidatedOnChange()) {
addNearCacheInvalidateListener();
}
}
use of com.hazelcast.client.spi.ClientContext in project hazelcast by hazelcast.
the class XAResourceProxy method getGroupName.
private String getGroupName() {
ClientContext context = getContext();
ClientTransactionManagerService transactionManager = context.getTransactionManager();
return transactionManager.getGroupName();
}
use of com.hazelcast.client.spi.ClientContext in project hazelcast by hazelcast.
the class XAResourceProxy method createTransactionContext.
private TransactionContext createTransactionContext(Xid xid) {
ClientContext clientContext = getContext();
ClientTransactionManagerService transactionManager = clientContext.getTransactionManager();
TransactionContext context = transactionManager.newXATransactionContext(xid, timeoutInSeconds.get());
getTransaction(context).begin();
return context;
}
use of com.hazelcast.client.spi.ClientContext in project hazelcast by hazelcast.
the class NearCachedClientMapProxy method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
ClientContext context = getContext();
logger = context.getLoggingService().getLogger(getClass());
NearCacheConfig nearCacheConfig = context.getClientConfig().getNearCacheConfig(name);
NearCacheManager nearCacheManager = context.getNearCacheManager();
IMapDataStructureAdapter<K, V> adapter = new IMapDataStructureAdapter<K, V>(this);
nearCache = nearCacheManager.getOrCreateNearCache(name, nearCacheConfig, adapter);
invalidateOnChange = nearCache.isInvalidatedOnChange();
if (invalidateOnChange) {
addNearCacheInvalidationListener(new ConnectedServerVersionAwareNearCacheEventHandler());
}
}
Aggregations