本文整理汇总了Java中net.jini.lease.LeaseRenewalManager类的典型用法代码示例。如果您正苦于以下问题:Java LeaseRenewalManager类的具体用法?Java LeaseRenewalManager怎么用?Java LeaseRenewalManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LeaseRenewalManager类属于net.jini.lease包,在下文中一共展示了LeaseRenewalManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterPropertiesSet
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
public void afterPropertiesSet() throws Exception {
this.transactionManager = doCreateTransactionManager();
Assert.notNull(this.transactionManager, "Jini transactionManager is required");
if (transactionalContext == null) {
transactionalContext = transactionManager;
}
if ((transactionManager instanceof NestableTransactionManager)) {
setNestedTransactionAllowed(true);
}
if (leaseRenewalConfig != null) {
leaseRenewalManagers = new LeaseRenewalManager[leaseRenewalConfig.getPoolSize()];
for (int i = 0; i < leaseRenewalConfig.getPoolSize(); i++)
leaseRenewalManagers[i] = new LeaseRenewalManager(leaseRenewalConfig.getRenewRTT(), 2);
logger.debug(logMessage("Created transaction manager with lease renewal pool [" + leaseRenewalConfig.getPoolSize() + "] and RTT [" + leaseRenewalConfig.getRenewRTT() + "]"));
}
}
示例2: register
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
void register(RemoteLogger... loggers) {
if (loggers.length==0) {
logger.warn("No remoteLoggers found");
return;
}
for (RemoteLogger remoteLogger : loggers) {
try {
logger.debug("Registering with remote logger: {}", remoteLogger);
EventRegistration eventRegistration = remoteLogger.registerLogListener(proxy, null, Lease.FOREVER, filterMapList);
logger.debug("Got registration {} {} {}",
eventRegistration.getID(), eventRegistration.getSource(), eventRegistration.toString());
Lease providersEventLease = eventRegistration.getLease();
LeaseRenewalManager lrm = new LeaseRenewalManager();
providersEventLease.renew(Lease.ANY);
lrm.renewUntil(providersEventLease, Lease.FOREVER, MIN_LEASE, null);
eventRegistrations.put(remoteLogger, eventRegistration);
} catch(LeaseDeniedException | UnknownLeaseException | RemoteException e) {
logger.warn("Unable to register to remoteLogger {}", remoteLogger, e);
}
}
}
示例3: find
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
public static ServiceItem[] find(String name, Class type, long wait, String[] groups, LookupLocator[] locators) {
ServiceItem[] result;
BackwardsServiceDiscoveryManager sdm = null;
try {
sdm = new BackwardsServiceDiscoveryManager(
new LookupDiscoveryManager(groups, locators, null, ServiceConfigLoader.getConfiguration()),
new LeaseRenewalManager(),
ServiceConfigLoader.getConfiguration()
);
Entry[] attributes = null;
if (name != null) {
attributes = new Entry[]{
new Name(name)
};
}
ServiceTemplate template = new ServiceTemplate(
null,
new Class[]{type},
attributes
);
result = sdm.lookup(template, 1, 1, null, wait);
} catch (Exception e) {
// TODO add proper exception here
e.printStackTrace();
result = null;
}
if (sdm != null) {
sdm.terminate();
}
return result;
}
示例4: destroy
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
public void destroy() throws Exception {
if (leaseRenewalManagers != null) {
for (LeaseRenewalManager leaseRenewalManager : leaseRenewalManagers) {
leaseRenewalManager.terminate();
}
leaseRenewalManagers = null;
}
}
示例5: notify
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
@Override public void notify(MonitorRegistration registration) {
monitorRegistration = registration;
leaseManager = new LeaseRenewalManager(monitorRegistration.getLease(), Lease.FOREVER, null);
for(Request r : pendingUpdateRequests) {
r.updateRequest.registration = copyRegistration();
if (logger.isDebugEnabled())
logger.debug("Posted {} {} {}",
monitorRegistration.getIdentifier(), monitorRegistration.getOwner(), r.updateRequest.status);
requests.add(r);
}
pendingUpdateRequests.clear();
if(logger.isDebugEnabled())
logger.debug("Successful registration to a Monitor for {}, {}",
monitorRegistration.getIdentifier(), monitorRegistration.getOwner());
}
示例6: MonitoringControlFlowManager
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
public MonitoringControlFlowManager(Exertion exertion,
ProviderDelegate delegate,
RendezvousBean rendezvousBean) throws RemoteException, ConfigurationException {
super(exertion, delegate, rendezvousBean);
sessionMonitor = Accessor.get().getService(null, MonitoringManagement.class);
lrm = new LeaseRenewalManager(delegate.getProviderConfiguration());
}
示例7: ExisitingJiniTransactionHolder
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
public ExisitingJiniTransactionHolder(Created txCreated, int isolationLevel, LeaseRenewalManager leaseRenewalManager) {
super(txCreated, isolationLevel, leaseRenewalManager);
}
示例8: getLeaseRenewalManager
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
/**
* Returns the lease renewal manager associated with this transaction, can be <code>null</code>.
*/
public LeaseRenewalManager getLeaseRenewalManager() {
return leaseRenewalManager;
}
示例9: dicoveredImpl
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
private void dicoveredImpl(ServiceRegistrar[] reg) {
for (int i = 0; i < reg.length; i++) {
try {
synchronized (_discoveryLock) {
_inDiscoveredImpl = true;
// _logger.info("----
// _inDiscoveredImpl="+_inDiscoveredImpl);
_logger.info("Discovered LUS " + reg[i].getLocator());
// changed in v4.2 [ix01[
// WILL ONLY WORK WITH notify() synchronized on
// _discoveryLock
EventRegistration evtReg = reg[i].notify(_template,
TRANSITIONS, _listener, null, Long.MAX_VALUE);
Lease lease = (Lease) _leasePreparer.prepareProxy(evtReg
.getLease());
LusTree lusTree = new LusTree(reg[i], _tree, _template,
_filtersView.getInterfaces(), _filtersView
.getNameFilters(), _servicePreparer,
_filtersView.getPlugin());
_pluginReg.lusDiscovered(reg[i]);
ServiceNode lusNode = lusTree.getRoot();
// EventRegistration
// evtReg=reg[i].notify(_template,TRANSITIONS,_listener,null,Long.MAX_VALUE);
// Lease lease=lease=evtReg.getLease();
lusNode.setUserObject(lease);
_lrm = new LeaseRenewalManager();
_lrm.renewUntil(lease, Long.MAX_VALUE, new LeaseListener() {
public void notify(LeaseRenewalEvent evt) {
_logger.info("LeaseRenewalEvent " + evt);
}
});
_logger
.info("Registering for events: initial lease expires "
+ new java.util.Date(lease.getExpiration()));
// updates the Service-centric view
updateServicesTree();
_inDiscoveredImpl = false;
// _logger.info("----
// _inDiscoveredImpl="+_inDiscoveredImpl);
_discoveryLock.notifyAll();
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
_inDiscoveredImpl = false;
}
}
_tree.expandRow(0);
}
示例10: getLeaseManager
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
static LeaseRenewalManager getLeaseManager() {
return leaseManager;
}
示例11: SpaceTaker
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
/**
* Default constructor. Set the worker thread as a Daemon thread
*/
public SpaceTaker() {
lrm = new LeaseRenewalManager();
}
示例12: getLrm
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
public LeaseRenewalManager getLrm() {
return lrm;
}
示例13: setLrm
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
public void setLrm(LeaseRenewalManager lrm) {
this.lrm = lrm;
}
示例14: init
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
@Before
public void init() {
Accessor.create();
leaseRenewalManager = new LeaseRenewalManager();
}
示例15: JiniTransactionHolder
import net.jini.lease.LeaseRenewalManager; //导入依赖的package包/类
/**
* Constructs a new jini transaction holder.
*
* @param txCreated The Jini transaction created object
* @param isolationLevel The isolation level that transaction is executed under
* @param leaseRenewalManager The lease renewal manager for the transaction (can be <code>null</code>)
*/
public JiniTransactionHolder(Transaction.Created txCreated, int isolationLevel, LeaseRenewalManager leaseRenewalManager) {
this.txCreated = txCreated;
this.isolationLevel = isolationLevel;
this.leaseRenewalManager = leaseRenewalManager;
this.referenceCount.incrementAndGet();
}