congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.terracotta.connection
Code IndexAdd Tabnine to your IDE (free)

How to use org.terracotta.connection

Best Java code snippets using org.terracotta.connection (Showing top 20 results out of 315)

origin: ehcache/ehcache3

 private static EntityRef<VoltronReadWriteLockClient, Void, Void> createEntityRef(Connection connection, String identifier) throws EntityNotProvidedException {
  return connection.getEntityRef(VoltronReadWriteLockClient.class, 1, "VoltronReadWriteLock-" + identifier);
 }
}
origin: ehcache/ehcache3

public void closeConnection() {
 Connection conn = clusterConnection;
 clusterConnection = null;
 if(conn != null) {
  try {
   conn.close();
  } catch (IOException | ConnectionShutdownException e) {
   LOGGER.warn("Error closing cluster connection: " + e);
  }
 }
}
origin: ehcache/ehcache3

 private Connection getConnection() throws ConnectionException {
  if (mockConnection == null) {
   throw new ConnectionException(new IllegalStateException("Set mock connection first"));
  }
  return mockConnection;
 }
}
origin: ehcache/ehcache3

private static <T extends Entity> void fetchEntity(Connection connection, Class<T> aClass, String myCacheManager) throws EntityNotFoundException, ConnectionException {
 try {
  connection.getEntityRef(aClass, EhcacheEntityVersion.ENTITY_VERSION, myCacheManager).fetchEntity(null).close();
 } catch (EntityNotProvidedException | EntityVersionMismatchException e) {
  throw new AssertionError(e);
 }
}
origin: ehcache/ehcache3

private void mockLockForWriteLockSuccess() throws org.terracotta.exception.EntityNotProvidedException, org.terracotta.exception.EntityNotFoundException, org.terracotta.exception.EntityVersionMismatchException {
 when(connection.<VoltronReadWriteLockClient, Object, Void>getEntityRef(same(VoltronReadWriteLockClient.class), eq(1L), any())).thenReturn(lockEntityRef);
 VoltronReadWriteLockClient lockClient = mock(VoltronReadWriteLockClient.class);
 when(lockEntityRef.fetchEntity(null)).thenReturn(lockClient);
 when(lockClient.tryLock(LockMessaging.HoldType.WRITE)).thenReturn(true);
}
origin: ehcache/ehcache3

public void destroyClusteredStoreEntity(String clusterTierManagerIdentifier, String storeIdentifier) throws EntityNotFoundException, CachePersistenceException {
 EntityRef<InternalClusterTierClientEntity, ClusterTierEntityConfiguration, Void> entityRef;
 try {
  entityRef = connection.getEntityRef(InternalClusterTierClientEntity.class, ENTITY_VERSION, entityName(clusterTierManagerIdentifier, storeIdentifier));
  if (!entityRef.destroy()) {
   throw new CachePersistenceException("Cannot destroy cluster tier '" + storeIdentifier + "': in use by other client(s)");
  }
 } catch (EntityNotProvidedException | PermanentEntityException e) {
  throw new AssertionError(e);
 }
}
origin: ehcache/ehcache3

private void mockLockForReadLockSuccess() throws org.terracotta.exception.EntityNotProvidedException, org.terracotta.exception.EntityNotFoundException, org.terracotta.exception.EntityVersionMismatchException {
 when(connection.<VoltronReadWriteLockClient, Object, Void>getEntityRef(same(VoltronReadWriteLockClient.class), eq(1L), any())).thenReturn(lockEntityRef);
 VoltronReadWriteLockClient lockClient = mock(VoltronReadWriteLockClient.class);
 when(lockEntityRef.fetchEntity(null)).thenReturn(lockClient);
 when(lockClient.tryLock(LockMessaging.HoldType.READ)).thenReturn(true);
}
origin: ehcache/ehcache3

private EntityRef<ClusterTierManagerClientEntity, ClusterTierManagerConfiguration, ClusterTierUserData> getEntityRef(String identifier) {
 try {
  return connection.getEntityRef(ClusterTierManagerClientEntity.class, ENTITY_VERSION, identifier);
 } catch (EntityNotProvidedException e) {
  LOGGER.error("Unable to get cluster tier manager for id {}", identifier, e);
  throw new AssertionError(e);
 }
}
origin: ehcache/ehcache3

@AfterClass
public static void closeConnection() throws IOException {
 CONNECTION.close();
}
origin: ehcache/ehcache3

private static void addMockLock(Connection connection, String lockname, boolean result, Boolean ... results) throws Exception {
 VoltronReadWriteLockClient lock = mock(VoltronReadWriteLockClient.class);
 when(lock.tryLock(any(HoldType.class))).thenReturn(result, results);
 @SuppressWarnings("unchecked")
 EntityRef<VoltronReadWriteLockClient, Object, Object> interlockRef = mock(EntityRef.class);
 when(connection.getEntityRef(eq(VoltronReadWriteLockClient.class), anyLong(), eq(lockname))).thenReturn(interlockRef);
 when(interlockRef.fetchEntity(null)).thenReturn(lock);
}
origin: ehcache/ehcache3

 private EntityRef<ClusterTierManagerClientEntity, ClusterTierManagerConfiguration, Void> getEntityRef(Connection client) throws org.terracotta.exception.EntityNotProvidedException {
  return client.getEntityRef(ClusterTierManagerClientEntity.class, ENTITY_VERSION, "crud-cm");
 }
}
origin: ehcache/ehcache3

@AfterClass
public static void closeAssertionConnection() throws IOException {
 ASSERTION_CONNECTION.close();
}
origin: ehcache/ehcache3

@Override
public<T extends Entity, C, U> EntityRef<T, C, U>  getEntityRef(Class<T> cls, long version, String name) throws EntityNotProvidedException {
 return ASSERTION_CONNECTION.getEntityRef(cls, version, name);
}
origin: ehcache/ehcache3

public static void removeStripe(String stripeName) {
 StripeDescriptor stripeDescriptor = STRIPES.remove(stripeName);
 for (Connection connection : stripeDescriptor.getConnections()) {
  try {
   LOGGER.warn("Force close {}", formatConnectionId(connection));
   connection.close();
  } catch (IllegalStateException | IOException e) {
   // Ignored in case connection is already closed
  }
 }
 stripeDescriptor.removeConnections();
}
origin: ehcache/ehcache3

private EntityRef<VoltronReadWriteLockClient, Void, Void> getEntityReference(Connection connection) throws EntityNotProvidedException {
 return connection.getEntityRef(VoltronReadWriteLockClient.class, 1, "TestEntity");
}
origin: ehcache/ehcache3

private EntityRef<E, C, U> getEntityRef() {
 try {
  return getConnection().getEntityRef(entityType, entityVersion, entityIdentifier);
 } catch (EntityNotProvidedException e) {
  LOGGER.error("Unable to find reference for entity {} for id {}", entityType.getName(), entityIdentifier, e);
  throw new AssertionError(e);
 }
}
origin: ehcache/ehcache3

public ClusterTierClientEntity getClusterTierClientEntity(String clusterTierManagerIdentifier, String storeIdentifier) throws EntityNotFoundException {
 EntityRef<InternalClusterTierClientEntity, ClusterTierEntityConfiguration, ClusterTierUserData> entityRef;
 try {
  entityRef = connection.getEntityRef(InternalClusterTierClientEntity.class, ENTITY_VERSION, entityName(clusterTierManagerIdentifier, storeIdentifier));
 } catch (EntityNotProvidedException e) {
  throw new AssertionError(e);
 }
 return fetchClusterTierClientEntity(storeIdentifier, entityRef);
}
origin: ehcache/ehcache3

 private <E extends Entity> EntityRef<E, Object, Void> getEntityRef(Class<E> value) throws org.terracotta.exception.EntityNotProvidedException {
  return connection.getEntityRef(same(value), eq(ENTITY_VERSION), any());
 }
}
origin: ehcache/ehcache3

 private EntityRef<ClusterTierManagerClientEntity, ClusterTierManagerConfiguration, Void> getEntityRef(Connection client) throws org.terracotta.exception.EntityNotProvidedException {
  return client.getEntityRef(ClusterTierManagerClientEntity.class, EhcacheEntityVersion.ENTITY_VERSION, testName.getMethodName());
 }
}
origin: ehcache/ehcache3

 private <E extends Entity> EntityRef<E, Object, Void> getEntityRef(Class<E> value) throws org.terracotta.exception.EntityNotProvidedException {
  return connection.getEntityRef(eq(value), anyLong(), anyString());
 }
}
org.terracotta.connection

Most used classes

  • Connection
    Represents a connection to a cluster
  • EntityRef
    The EntityRef is a reference to where an entity could potentially exist. That is, it is created to r
  • Entity
    An instance of this type represents a concrete connection to a server-side entity. The entity always
  • ConnectionFactory
    Factory for generating connections to stripe.
  • ConnectionException
    The exception type thrown when a connection fails to be established by the connection service.
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now