Revision 6702
Added by Chris Jones over 12 years ago
HazelcastService.java | ||
---|---|---|
42 | 42 |
import com.hazelcast.core.EntryEvent; |
43 | 43 |
import com.hazelcast.core.EntryListener; |
44 | 44 |
import com.hazelcast.core.Hazelcast; |
45 |
import com.hazelcast.core.ILock; |
|
45 | 46 |
import com.hazelcast.core.IMap; |
46 | 47 |
import com.hazelcast.core.InstanceEvent; |
47 | 48 |
import com.hazelcast.core.InstanceListener; |
... | ... | |
103 | 104 |
|
104 | 105 |
/* The Hazelcast distributed system metadata map */ |
105 | 106 |
private IMap<Identifier, SystemMetadata> systemMetadata; |
106 |
|
|
107 |
|
|
107 | 108 |
/* |
108 | 109 |
* Constructor: Creates an instance of the hazelcast service. Since |
109 | 110 |
* this uses a singleton pattern, use getInstance() to gain the instance. |
... | ... | |
221 | 222 |
public IMap<Identifier,SystemMetadata> getSystemMetadataMap() { |
222 | 223 |
return systemMetadata; |
223 | 224 |
} |
225 |
|
|
226 |
public ILock getLock(Identifier identifier) { |
|
227 |
|
|
228 |
ILock lock = null; |
|
229 |
|
|
230 |
try { |
|
231 |
lock = getInstance().getLock(identifier); |
|
232 |
|
|
233 |
} catch (RuntimeException e) { |
|
234 |
logMetacat.info("Couldn't get a lock for identifier " + |
|
235 |
identifier.getValue() + " !!"); |
|
236 |
} |
|
237 |
return lock; |
|
238 |
|
|
239 |
} |
|
224 | 240 |
|
225 | 241 |
/** |
226 | 242 |
* Get the DataONE hazelcast node map |
Also available in: Unified diff
Use the Hazelcast ILock mechanism to lock the system metadata identifier rather than using IMap.lock(pid).