use of com.swiftmq.mgmt.EntityRemoveException in project swiftmq-ce by iitsoftware.
the class Scheduler method visit.
public void visit(ScheduleRemoved po) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.schedulerSwiftlet.getName(), toString() + "/" + po + " ...");
Entry scheduleEntry = (Entry) schedules.remove(po.getName());
if (scheduleEntry != null) {
po.setSuccess(true);
stopSchedule(scheduleEntry);
try {
if (po.isMessageSchedule()) {
scheduleEntry.entity.setState(DONOTHING);
ctx.activeMessageScheduleList.removeEntity(scheduleEntry.entity);
} else
ctx.activeScheduleList.removeEntity(scheduleEntry.entity);
} catch (EntityRemoveException e) {
}
} else
po.setSuccess(false);
Semaphore sem = po.getSemaphore();
if (sem != null)
sem.notifySingleWaiter();
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.schedulerSwiftlet.getName(), toString() + "/" + po + " done");
}
use of com.swiftmq.mgmt.EntityRemoveException in project swiftmq-ce by iitsoftware.
the class BackupProcessor method visit.
public void visit(ScanSaveSets po) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.storeSwiftlet.getName(), toString() + "/" + po + " ...");
// Delete Usage content
Map entities = ctx.backupList.getEntities();
if (entities != null) {
for (Iterator iter = entities.entrySet().iterator(); iter.hasNext(); ) {
try {
ctx.backupList.removeEntity((Entity) ((Map.Entry) iter.next()).getValue());
} catch (EntityRemoveException e) {
}
}
}
// Scan save sets
File dir = new File(path);
File[] files = dir.listFiles(new FilenameFilter() {
public boolean accept(File d, String name) {
return name.startsWith(SAVESET) && d.isDirectory();
}
});
if (files != null) {
for (int i = 0; i < files.length; i++) {
scanSaveSet(files[i]);
}
}
// Check Number Generation and eventually delete the oldest Generation
String[] names = ctx.backupList.getEntityNames();
if (names != null && names.length > generations) {
Arrays.sort(names);
int toRemove = names.length - generations;
for (int i = 0; i < toRemove; i++) {
try {
ctx.backupList.removeEntity(ctx.backupList.getEntity(names[i]));
deleteSaveSet(new File(path + File.separatorChar + names[i]));
} catch (EntityRemoveException e) {
}
}
}
// Enqueue next PO
if (po.getNextPO() != null)
enqueue(po.getNextPO());
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.storeSwiftlet.getName(), toString() + "/" + po + " done");
}
use of com.swiftmq.mgmt.EntityRemoveException in project swiftmq-ce by iitsoftware.
the class QueueWireTapInput method close.
@Override
public void close() {
try {
if (usage != null)
ctx.usage.getEntity("inputs").removeEntity(usage);
} catch (EntityRemoveException e) {
}
if (started) {
AbstractQueue queue = ctx.ctx.queueManager.getQueueForInternalUse(destinationName);
if (queue != null)
queue.removeWireTapSubscriber(name, this);
started = false;
}
ctx.stream.removeInput(this);
}
use of com.swiftmq.mgmt.EntityRemoveException in project swiftmq-ce by iitsoftware.
the class RouteTable method removeUsageEntity.
private void removeUsageEntity(Route route) {
try {
Entity destEntity = dynRoutes.getEntity(route.getDestinationRouter());
if (destEntity != null) {
EntityList routes = (EntityList) destEntity.getEntity("dynamic-routes");
Entity re = routes.getEntity(route.getKey());
if (re != null) {
routes.removeEntity(re);
}
Map map = routes.getEntities();
if (map == null || map.size() == 0)
dynRoutes.removeEntity(destEntity);
}
} catch (EntityRemoveException e) {
e.printStackTrace();
}
}
use of com.swiftmq.mgmt.EntityRemoveException in project swiftmq-ce by iitsoftware.
the class DeleteDurableJob method start.
public void start(Properties properties, JobTerminationListener jobTerminationListener) throws JobException {
if (traceSpace.enabled)
traceSpace.trace(topicManager.getName(), toString() + "/start, properties=" + properties + " ...");
this.properties = properties;
if (stopCalled)
return;
Map entities = activeDurableList.getEntities();
int cnt = 0;
if (entities != null) {
String cPred = properties.getProperty("Client Id Predicate");
String dPred = properties.getProperty("Durable Name Predicate");
for (Iterator iter = entities.entrySet().iterator(); iter.hasNext(); ) {
Entity durable = (Entity) ((Map.Entry) iter.next()).getValue();
String clientId = (String) durable.getProperty("clientid").getValue();
String durableName = (String) durable.getProperty("durablename").getValue();
if (LikeComparator.compare(clientId, cPred, '\\') && LikeComparator.compare(durableName, dPred, '\\')) {
try {
activeDurableList.removeEntity(durable);
cnt++;
} catch (EntityRemoveException e) {
}
}
if (stopCalled)
return;
}
}
jobTerminationListener.jobTerminated(cnt + " durable Subscribers deleted");
}
Aggregations