org.apache.blur.server
Class ShardServerContext

java.lang.Object
  extended by org.apache.blur.server.BlurServerContext
      extended by org.apache.blur.server.ShardServerContext
All Implemented Interfaces:
ServerContext, ThriftTrace

public class ShardServerContext
extends BlurServerContext
implements ServerContext

The thrift session that will hold index reader references to maintain across query and fetch calls. Since there is a fixed size thread pool issuing calls that involve the _threadsToContext map where Thread is the key we don't need to clear or reset threads.


Constructor Summary
ShardServerContext(SocketAddress localSocketAddress, SocketAddress remoteSocketAddress)
           
 
Method Summary
 void close()
          Closes this context, this happens when the client closes it's connect to the server.
static void closeQuietly(Closeable closeable)
           
 IndexSearcherClosable getIndexSearcherClosable(String table, String shard)
          Gets the cached IndexSearcherClosable (if any) for the given table and shard.
static ShardServerContext getShardServerContext()
          Gets the ShardServerContext for this Thread.
static void registerContextForCall(ShardServerContext context)
          Registers the ShardServerContext for this thread.
 void reset()
          Resets the ShardServerContext by closing the searchers.
static void resetSearchers()
          Resets the context, this closes and releases the index readers.
 void setIndexSearcherClosable(String table, String shard, IndexSearcherClosable searcher)
          Sets the index searcher for this ShardServerContext for the given table and shard.
 
Methods inherited from class org.apache.blur.server.BlurServerContext
getConnectionString, getRemoteSocketAddress, getRocalSocketAddress, getTracer, getTraceRequestId, getTraceRootId, getUser, resetTraceIds, setTraceRequestId, setTraceRootId, setUser
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShardServerContext

public ShardServerContext(SocketAddress localSocketAddress,
                          SocketAddress remoteSocketAddress)
Method Detail

registerContextForCall

public static void registerContextForCall(ShardServerContext context)
Registers the ShardServerContext for this thread.

Parameters:
context - the ShardServerContext.

getShardServerContext

public static ShardServerContext getShardServerContext()
Gets the ShardServerContext for this Thread.

Returns:
the ShardServerContext.

resetSearchers

public static void resetSearchers()
Resets the context, this closes and releases the index readers.


close

public void close()
Closes this context, this happens when the client closes it's connect to the server.


reset

public void reset()
Resets the ShardServerContext by closing the searchers.


closeQuietly

public static void closeQuietly(Closeable closeable)

getIndexSearcherClosable

public IndexSearcherClosable getIndexSearcherClosable(String table,
                                                      String shard)
Gets the cached IndexSearcherClosable (if any) for the given table and shard.

Parameters:
table - the stable name.
shard - the shard name.
Returns:
the IndexSearcherClosable or null if not present.

setIndexSearcherClosable

public void setIndexSearcherClosable(String table,
                                     String shard,
                                     IndexSearcherClosable searcher)
                              throws IOException
Sets the index searcher for this ShardServerContext for the given table and shard.

Parameters:
table - the table name.
shard - the shard name.
searcher - the IndexSearcherClosable.
Throws:
IOException


Copyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.