class MatchSetProxy extends Object implements MatchSet
MatchSet
.
Outrigger's implementation of the JavaSpace05.contents
method returns objects of this type. Created with an initial set of
entries from the match set and supports pre-fetching whenever it
needs additional entries. RemoteException
s encountered
when making a remote call to fetch the next batch of entries from
the space generally do not invalidate the proxy or the match set.
Note, there is no way to serialize or otherwise copy instances of this class so the default equals implementation should suffice.
Modifier and Type | Field and Description |
---|---|
private int |
i
Current index into reps
|
private EntryRep |
lastRepReturned
Last rep returned
|
private Lease |
lease
Lease assocated with this query
|
private EntryRep[] |
reps
Last batch fetched from server
|
private OutriggerServer |
space
The remote server this proxy works with.
|
private boolean |
unpackFailure
True if reps[i] could not be unpacked
|
private Uuid |
uuid
ID of the associated query (and lease)
|
Constructor and Description |
---|
MatchSetProxy(MatchSetData inital,
SpaceProxy2 parent,
OutriggerServer space) |
Modifier and Type | Method and Description |
---|---|
Lease |
getLease()
Returns a proxy to the
Lease associated with this
match set, or null if this match set is not
leased. |
Entry |
getSnapshot()
|
Entry |
next()
Removes one
Entry from the match set and
returns a copy to the caller. |
String |
toString() |
private final OutriggerServer space
private final Uuid uuid
private final Lease lease
private EntryRep[] reps
private EntryRep lastRepReturned
private int i
private boolean unpackFailure
MatchSetProxy(MatchSetData inital, SpaceProxy2 parent, OutriggerServer space)
public Lease getLease()
MatchSet
Lease
associated with this
match set, or null
if this match set is not
leased.public Entry next() throws RemoteException, UnusableEntryException
MatchSet
Entry
from the match set and
returns a copy to the caller. Returns null
if
the match set is empty. The returned Entry
must be unmarshalled in accordance with the Jini Entry
Specification.
A given invocation of this method may perform remote
communications, but generally the next
method
is not expected to have remote method constraints that
can vary from invocation to invocation. Instead the set of
constraints associated with the next
method
will be fixed at the time the match set was created, even
if this object implements an interface like RemoteMethodControl
that would otherwise allow the set of
constraints associated with the next
method to
be altered.
next
in interface MatchSet
Entry
from the match set, or
null
if the match set is emptyRemoteException
- if a communication error occurs. If a
RemoteException
is thrown, no
Entry
was removed from the match set
because of this callUnusableEntryException
- if the entry removed from
the match set could not be unmarshalledpublic Entry getSnapshot()
MatchSet
Entry
removed by
the last call to next
. Snapshots are defined
in section JS.2.6 of the
JavaSpaces Service Specification and are an
alternative representation of a given Entry
produced by a particular space for use with that same
space. Passing a snapshot to a space is generally more
efficient than passing the original representation.
Any snapshot returned by this method will meet the same
contract as the object returned by passing the result of
the last next
invocation to JavaSpace.snapshot
.
Generally there is a cost associated with calling the
JavaSpace.snapshot
method. Thus creating a
snapshot using that method is usually only worthwhile if
the resulting snapshot is used more than once. The cost of
invoking this method should be low and should be worthwhile
even if the resulting snapshot is used only once.
getSnapshot
in interface MatchSet
Entry
removed
from the match set by the last call to next
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.