use of com.swiftmq.mgmt.PropertyChangeListener in project swiftmq-ce by iitsoftware.
the class MessageGroupDispatchPolicy method init.
private void init() {
Property prop = myEntity.getProperty("message-group-enabled");
enabled = ((Boolean) prop.getValue()).booleanValue();
prop.setPropertyChangeListener(new PropertyChangeListener() {
public void propertyChanged(Property property, Object oldValue, Object newValue) throws PropertyChangeException {
enabled = ((Boolean) newValue).booleanValue();
if (enabled)
restart();
else
reset();
}
});
prop = myEntity.getProperty("message-group-property");
propName = (String) prop.getValue();
prop.setPropertyChangeListener(new PropertyChangeListener() {
public void propertyChanged(Property property, Object oldValue, Object newValue) throws PropertyChangeException {
if (enabled)
throw new PropertyChangeException("Please disable message grouping for this clustered queue before you change this property!");
propName = (String) newValue;
}
});
prop = myEntity.getProperty("message-group-expiration");
expiration = ((Long) prop.getValue()).longValue();
prop.setPropertyChangeListener(new PropertyChangeListener() {
public void propertyChanged(Property property, Object oldValue, Object newValue) throws PropertyChangeException {
expiration = ((Long) newValue).longValue();
if (enabled && expiration != 0)
checkExpiration();
}
});
prop = myEntity.getProperty("message-group-expiration-cleanup-interval");
cleanupInterval = ((Long) prop.getValue()).longValue();
prop.setPropertyChangeListener(new PropertyChangeListener() {
public void propertyChanged(Property property, Object oldValue, Object newValue) throws PropertyChangeException {
cleanupInterval = changeCleanupInterval(((Long) newValue).longValue());
}
});
}
use of com.swiftmq.mgmt.PropertyChangeListener in project swiftmq-ce by iitsoftware.
the class StableStore method init.
private void init() throws Exception {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$store", toString() + "/init ...");
nFree = 0;
if (freePoolEnabled)
freePool = new IntRingBuffer[10];
filename = path + File.separatorChar + FILENAME;
emptyData = new byte[Page.PAGE_SIZE];
// emtpy
emptyData[0] = 1;
for (int i = 1; i < Page.PAGE_SIZE; i++) emptyData[i] = 0;
file = new RandomAccessFile(filename, "rw");
fileLength = file.length();
if (fileLength > 0) {
numberPages = (int) (fileLength / Page.PAGE_SIZE);
if (!offline)
shrinkFile();
} else
initialize(initialPages);
sync();
if (freePoolEnabled)
buildFreePageList();
if (!offline) {
Entity entity = ctx.filesList.createEntity();
entity.setName(FILENAME);
entity.createCommands();
ctx.filesList.addEntity(entity);
freeProp = entity.getProperty("free-pages");
usedProp = entity.getProperty("used-pages");
fileSizeProp = entity.getProperty("file-size");
sizeCollectProp = ctx.dbEntity.getProperty("size-collect-interval");
collectInterval = (long) (Long) sizeCollectProp.getValue();
startTimer();
PropertyChangeListener propChangeListener = new PropertyChangeListener() {
public void propertyChanged(Property property, Object oldValue, Object newValue) throws PropertyChangeException {
stopTimer();
collectInterval = (Long) newValue;
startTimer();
}
};
sizeCollectProp.setPropertyChangeListener(propChangeListener);
swiftletManagerAdapter = new SwiftletManagerAdapter() {
public void swiftletStarted(SwiftletManagerEvent event) {
mgmtSwiftlet = (MgmtSwiftlet) SwiftletManager.getInstance().getSwiftlet("sys$mgmt");
mgmtSwiftlet.addMgmtListener(StableStore.this);
}
};
SwiftletManager.getInstance().addSwiftletManagerListener("sys$mgmt", swiftletManagerAdapter);
}
ctx.logSwiftlet.logInformation("sys$store", toString() + "/init done, size=" + numberPages + ", freePages=" + getNumberFreePages());
}
Aggregations