public abstract class ResourceService extends Object
UUID
to be read by a remote service. This class runs one thread to
accept connections and thread pool to send data.Modifier and Type | Class and Description |
---|---|
static class |
ResourceService.Counters
Performance counters for the
ResourceService . |
static class |
ResourceService.FetchResourceTask<S,T>
Client for a
BufferService reads a single resource from the
specified service, writing it into the local file system. |
static class |
ResourceService.ReadBufferTask
Class sends a request for a remote
ByteBuffer and then receives
the data into a local ByteBuffer . |
static class |
ResourceService.ReadResourceTask
Task sends a request for a file's data and then receives the data onto a
local file.
|
static class |
ResourceService.ResourceTypeEnum
Type safe enumeration of the kinds of resources which can be served.
|
static class |
ResourceService.StatusEnum
Known status codes.
|
Modifier and Type | Field and Description |
---|---|
ResourceService.Counters |
counters
Performance counters for this service.
|
protected static org.apache.log4j.Logger |
log |
Constructor and Description |
---|
ResourceService(InetSocketAddress addr,
int requestServicePoolSize)
Create and start the service.
|
Modifier and Type | Method and Description |
---|---|
void |
awaitRunning(long timeout,
TimeUnit unit)
Wait until the service is running.
|
protected void |
finalize()
Overridden to ensure that the service is always shutdown.
|
InetSocketAddress |
getAddr()
Return the address at which this service is accepting connections.
|
protected abstract ByteBuffer |
getBuffer(UUID uuid)
Return
ByteBuffer identified by the UUID . |
protected abstract File |
getResource(UUID uuid)
Return file identified by the
UUID . |
boolean |
isOpen() |
void |
shutdown() |
void |
shutdownNow() |
protected static final org.apache.log4j.Logger log
public final ResourceService.Counters counters
public ResourceService(InetSocketAddress addr, int requestServicePoolSize) throws IOException
addr
- The IP address and port at which the service will accept
connections. The port MAY be zero to use an ephemeral port.requestServicePoolSize
- The size of the thread pool that will handle requests. When
ZERO (0) a cached thread pool will be used with no specific
size limit.IOException
public InetSocketAddress getAddr()
protected void finalize() throws Throwable
public void awaitRunning(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException
timeout
- The timeout.unit
- The unit for the timeout.InterruptedException
- if interrupted while waiting.TimeoutException
- if the timeout expired before the service was running.public boolean isOpen()
public void shutdown()
public void shutdownNow()
protected abstract File getResource(UUID uuid) throws Exception
UUID
.protected abstract ByteBuffer getBuffer(UUID uuid) throws Exception
ByteBuffer
identified by the UUID
.uuid
- ByteBuffer
-or- null
if there is no
buffer associated with that UUID
.Exception
- if the resource may not be served.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.