Tabnine Logo
Connection
Code IndexAdd Tabnine to your IDE (free)

How to use
Connection
in
org.terracotta.connection

Best Java code snippets using org.terracotta.connection.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 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 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

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

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

private void closeConnection() throws IOException {
 Collection<Connection> connections = UnitTestConnectionService.getConnections(CLUSTER_URI);
 assertThat(connections.size(), is(1));
 Connection connection = connections.iterator().next();
 connection.close();
}
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

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

@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

@Test
public void testInitializeStateAfterConnectionCloses() throws Exception {
 ConnectionState connectionState = new ConnectionState(Timeouts.DEFAULT, new Properties(), serviceConfiguration);
 connectionState.initClusterConnection();
 closeConnection();
 expectedException.expect(IllegalStateException.class);
 connectionState.getConnection().close();
 connectionState.initializeState();
 assertThat(connectionState.getConnection(), notNullValue());
 assertThat(connectionState.getEntityFactory(), notNullValue());
 connectionState.getConnection().close();
}
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

try {
 LOGGER.warn("Force close {}", formatConnectionId(connection));
 connection.close();
} catch (AssertionError | IOException e) {
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

connection.close();
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

public static void tearDownCacheManagerAndStatsCollector() throws Exception {
 if (cacheManager != null && cacheManager.getStatus() == Status.AVAILABLE) {
  if (nmsService != null) {
   readTopology().getClient(ehcacheClientIdentifier)
    .ifPresent(client -> {
     try {
      nmsService.stopStatisticCollector(client.getContext().with("cacheManagerName", "my-super-cache-manager")).waitForReturn();
     } catch (Exception e) {
      throw new RuntimeException(e);
     }
    });
  }
  cacheManager.close();
 }
 if (nmsService != null) {
  readTopology().getSingleStripe().getActiveServerEntity(tmsServerEntityIdentifier)
   .ifPresent(client -> {
    try {
     nmsService.stopStatisticCollector(client.getContext());
    } catch (Exception e) {
     throw new RuntimeException(e);
    }
   });
  managementConnection.close();
 }
}
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

client.close();
org.terracotta.connectionConnection

Javadoc

Represents a connection to a cluster

Most used methods

  • getEntityRef
    Get a reference to the given entity. The entity may or may not yet exist. This is a pointer to the s
  • close

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • setRequestProperty (URLConnection)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Best plugins for Eclipse
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