Tabnine Logo
CachePool.fetchCache
Code IndexAdd Tabnine to your IDE (free)

How to use
fetchCache
method
in
org.apache.polygene.spi.cache.CachePool

Best Java code snippets using org.apache.polygene.spi.cache.CachePool.fetchCache (Showing top 12 results out of 315)

origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void givenLoooongCacheNameWhenFetchingCacheExpectOk()
{
  Random random = new Random();
  StringBuilder longName = new StringBuilder();
  for( int i = 0; i < 10000; i++ )
  {
    longName.append( (char) ( random.nextInt( 26 ) + 65 ) );
  }
  cache = cachePool.fetchCache( longName.toString(), String.class );
}
origin: apache/attic-polygene-java

@Test
public void givenLoooongCacheNameWhenFetchingCacheExpectOk()
{
  Random random = new Random();
  StringBuilder longName = new StringBuilder();
  for( int i = 0; i < 10000; i++ )
  {
    longName.append( (char) ( random.nextInt( 26 ) + 65 ) );
  }
  cache = cachePool.fetchCache( longName.toString(), String.class );
}
origin: org.apache.polygene.core/org.apache.polygene.core.spi

@Override
public void setUpJSONMapES()
  throws Exception
{
  uuid = descriptor.identity() + "-" + UUID.randomUUID().toString();
  if( caching != null )
  {
    cache = caching.fetchCache( uuid, CacheState.class );
  }
  else
  {
    cache = new NullCache<>();
  }
}
origin: apache/attic-polygene-java

@Override
public void setUpJSONMapES()
  throws Exception
{
  uuid = descriptor.identity() + "-" + UUID.randomUUID().toString();
  if( caching != null )
  {
    cache = caching.fetchCache( uuid, CacheState.class );
  }
  else
  {
    cache = new NullCache<>();
  }
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void givenInvalidCacheNameWhenFetchingCacheExpectIllegalArgumentException()
{
  try
  {
    cache = cachePool.fetchCache( "", String.class );
    fail( "Expected " + IllegalArgumentException.class.getSimpleName() );
  }
  catch( IllegalArgumentException e )
  {
    // expected
  }
}
origin: apache/attic-polygene-java

@Test
public void givenInvalidCacheNameWhenFetchingCacheExpectIllegalArgumentException()
{
  try
  {
    cache = cachePool.fetchCache( "", String.class );
    fail( "Expected " + IllegalArgumentException.class.getSimpleName() );
  }
  catch( IllegalArgumentException e )
  {
    // expected
  }
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public void setUp()
  throws Exception
{
  super.setUp();
  cachePool = module.instance().findService( CachePool.class ).get();
  cache = cachePool.fetchCache( "1", String.class );
}
origin: apache/attic-polygene-java

@Override
public void setUp()
  throws Exception
{
  super.setUp();
  cachePool = module.instance().findService( CachePool.class ).get();
  cache = cachePool.fetchCache( "1", String.class );
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void givenNullKeyWhenFetchingCacheExpectConstraintViolationException()
{
  try
  {
    cache = cachePool.fetchCache( null, String.class );
    fail( "Expected " + ConstraintViolationException.class.getSimpleName() );
  }
  catch( ConstraintViolationException e )
  {
    // expected
    Collection<ValueConstraintViolation> violations = e.constraintViolations();
    assertEquals( 1, violations.size() );
    ValueConstraintViolation violation = violations.iterator().next();
    assertEquals( "not optional", violation.constraint().toString() );
    assertThat( violation.name(), anyOf(equalTo("cacheId"), equalTo( "arg0" )) );  // depends on whether -parameters was given at compile time.
  }
}
origin: apache/attic-polygene-java

@Test
public void givenNullKeyWhenFetchingCacheExpectConstraintViolationException()
{
  try
  {
    cache = cachePool.fetchCache( null, String.class );
    fail( "Expected " + ConstraintViolationException.class.getSimpleName() );
  }
  catch( ConstraintViolationException e )
  {
    // expected
    Collection<ValueConstraintViolation> violations = e.constraintViolations();
    assertEquals( 1, violations.size() );
    ValueConstraintViolation violation = violations.iterator().next();
    assertEquals( "not optional", violation.constraint().toString() );
    assertThat( violation.name(), anyOf(equalTo("cacheId"), equalTo( "arg0" )) );  // depends on whether -parameters was given at compile time.
  }
}
origin: apache/attic-polygene-java

  @Test
  public void givenCacheWithValueWhenDroppingReferenceAndRequestNewCacheAndItsValueExpectItToBeGone()
  {
    cache.put( "Habba", "Zout" );
    assertEquals( "Zout", cache.get( "Habba" ) );
    cachePool.returnCache( cache );
    cache = cachePool.fetchCache( "1", String.class );
    assertNull( "Value not missing", cache.get( "Habba" ) );
  }
}
origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

  @Test
  public void givenCacheWithValueWhenDroppingReferenceAndRequestNewCacheAndItsValueExpectItToBeGone()
  {
    cache.put( "Habba", "Zout" );
    assertEquals( "Zout", cache.get( "Habba" ) );
    cachePool.returnCache( cache );
    cache = cachePool.fetchCache( "1", String.class );
    assertNull( "Value not missing", cache.get( "Habba" ) );
  }
}
org.apache.polygene.spi.cacheCachePoolfetchCache

Javadoc

Fetches a cache from the pool. If the cache does not exist already, then a new Cache should be created and returned. For each fetchCache() call, a reference count on the Cache must be increased.

Popular methods of CachePool

  • returnCache
    Returns the cache back to the pool. The reference count for the cache must then be decreased and if

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • ImageIO (javax.imageio)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • CodeWhisperer alternatives
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