T
- the type of service objectpublic abstract class AbstractServiceReference<T> extends Object implements ServiceReference
Modifier and Type | Field and Description |
---|---|
protected T |
service |
protected Vertx |
vertx |
Constructor and Description |
---|
AbstractServiceReference(Vertx vertx,
ServiceDiscovery discovery,
Record record)
Creates a new instance of
AbstractServiceReference . |
Modifier and Type | Method and Description |
---|---|
<X> X |
cached()
Returns the service object.
|
protected void |
close()
Callback that let you cleanup the service object.
|
<X> X |
get()
Gets the service object.
|
Record |
record() |
void |
release()
If the service object has been retrieved, calls
close() and release the reference. |
protected abstract T |
retrieve()
Method to implement to retrieve the service object.
|
public AbstractServiceReference(Vertx vertx, ServiceDiscovery discovery, Record record)
AbstractServiceReference
.vertx
- the vert.x instancerecord
- the service recordpublic <X> X cached()
null
.cached
in interface ServiceReference
X
- the type of result.null
if nonepublic <X> X get()
retrieve()
, otherwise returned the cached value.get
in interface ServiceReference
X
- the type of resultprotected abstract T retrieve()
protected void close()
public Record record()
record
in interface ServiceReference
public void release()
close()
and release the reference. Otherwise, does nothing.release
in interface ServiceReference
Copyright © 2016. All rights reserved.