link start!
This commit is contained in:
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.virtual;
|
||||
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.category.BCategoryMask;
|
||||
import javax.baja.category.BCategoryService;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.BValue;
|
||||
import javax.baja.sys.BVector;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.virtual.BVirtualGateway;
|
||||
import javax.baja.virtual.VirtualPath;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BVirtualComponent
|
||||
extends BComponent {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
long lastActiveTicks;
|
||||
static /* synthetic */ Class class$javax$baja$virtual$BVirtualComponent;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public boolean performAutoRemoval() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final long getLastActiveTicks() {
|
||||
return this.lastActiveTicks;
|
||||
}
|
||||
|
||||
public final void setLastActiveTicks(long l) {
|
||||
this.lastActiveTicks = l;
|
||||
}
|
||||
|
||||
public final BVirtualGateway getVirtualGateway() {
|
||||
BComponentSpace bComponentSpace = this.getComponentSpace();
|
||||
if (bComponentSpace == null) {
|
||||
return null;
|
||||
}
|
||||
BINavNode bINavNode = bComponentSpace.getNavParent();
|
||||
if (bINavNode instanceof BVirtualGateway) {
|
||||
return (BVirtualGateway)bINavNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BOrd getCategorizableOrd() {
|
||||
BOrd bOrd = this.getNavOrd();
|
||||
if (bOrd != null) {
|
||||
return bOrd.relativizeToSession();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isChildLegal(BComponent bComponent) {
|
||||
boolean bl = false;
|
||||
if (bComponent instanceof BVirtualComponent || bComponent instanceof BVector) {
|
||||
bl = true;
|
||||
}
|
||||
return bl;
|
||||
}
|
||||
|
||||
public boolean isParentLegal(BComponent bComponent) {
|
||||
return bComponent instanceof BVirtualComponent;
|
||||
}
|
||||
|
||||
public final BOrd getNavOrd() {
|
||||
BOrd bOrd;
|
||||
BComponentSpace bComponentSpace = this.getComponentSpace();
|
||||
if (bComponentSpace == null) {
|
||||
return null;
|
||||
}
|
||||
BOrd bOrd2 = bOrd = this.getVirtualGateway() == null ? bComponentSpace.getAbsoluteOrd() : bComponentSpace.getNavOrd();
|
||||
if (bOrd == null) {
|
||||
return null;
|
||||
}
|
||||
SlotPath slotPath = this.getSlotPath();
|
||||
if (slotPath == null) {
|
||||
return null;
|
||||
}
|
||||
VirtualPath virtualPath = VirtualPath.convertFromSlotPath(slotPath);
|
||||
return BOrd.make(bOrd, virtualPath).normalize();
|
||||
}
|
||||
|
||||
public BCategoryMask getAppliedCategoryMask() {
|
||||
BComponent bComponent;
|
||||
BOrd bOrd = this.getCategorizableOrd();
|
||||
if (bOrd != null && !bOrd.isNull()) {
|
||||
bComponent = null;
|
||||
if (this.isRunning()) {
|
||||
bComponent = BCategoryService.getService();
|
||||
} else {
|
||||
bComponent = (BCategoryService)BOrd.make(this.getVirtualGateway().getAbsoluteOrd(), "service:baja:CategoryService").get();
|
||||
bComponent.lease(1);
|
||||
}
|
||||
BCategoryMask bCategoryMask = ((BCategoryService)bComponent).getOrdMap().getAppliedCategoryMask(bOrd.relativizeToSession());
|
||||
if (bCategoryMask != null) {
|
||||
return bCategoryMask;
|
||||
}
|
||||
}
|
||||
if ((bComponent = this.getVirtualGateway()) != null) {
|
||||
return bComponent.getAppliedCategoryMask();
|
||||
}
|
||||
return super.getAppliedCategoryMask();
|
||||
}
|
||||
|
||||
public BCategoryMask getCategoryMask() {
|
||||
BOrd bOrd = this.getCategorizableOrd();
|
||||
if (bOrd != null && !bOrd.isNull()) {
|
||||
BCategoryService bCategoryService = null;
|
||||
if (this.isRunning() || this.getVirtualGateway() == null) {
|
||||
bCategoryService = BCategoryService.getService();
|
||||
} else {
|
||||
bCategoryService = (BCategoryService)BOrd.make(this.getVirtualGateway().getAbsoluteOrd(), "service:baja:CategoryService").get();
|
||||
bCategoryService.lease(1);
|
||||
}
|
||||
BCategoryMask bCategoryMask = bCategoryService.getOrdMap().getCategoryMask(bOrd.relativizeToSession());
|
||||
if (bCategoryMask != null) {
|
||||
return bCategoryMask;
|
||||
}
|
||||
}
|
||||
return BCategoryMask.NULL;
|
||||
}
|
||||
|
||||
public AgentList getAgents(Context context) {
|
||||
AgentList agentList = super.getAgents(context);
|
||||
agentList.remove("pxEditor:PxEditor");
|
||||
agentList.remove("wiresheet:WireSheet");
|
||||
agentList.remove("workbench:LinkSheet");
|
||||
return agentList;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
BValue bValue = this.get("icon");
|
||||
if (bValue instanceof BIcon) {
|
||||
return (BIcon)bValue;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
spyWriter.startProps();
|
||||
spyWriter.trTitle("VirtualComponent", 2);
|
||||
spyWriter.prop((Object)"performAutoRemoval", this.performAutoRemoval());
|
||||
spyWriter.prop((Object)"lastActiveTicks", this.getLastActiveTicks() + " (" + BAbsTime.make(this.getLastActiveTicks()).encodeToString() + ')');
|
||||
spyWriter.prop((Object)"categorizableOrd", this.getCategorizableOrd());
|
||||
spyWriter.endProps();
|
||||
super.spy(spyWriter);
|
||||
}
|
||||
|
||||
public Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
switch (n) {
|
||||
case 11: {
|
||||
this.updateTicks();
|
||||
break;
|
||||
}
|
||||
case 12: {
|
||||
this.updateTicks();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
this.updateTicks();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
void updateTicks() {
|
||||
this.setLastActiveTicks(Clock.ticks());
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.lastActiveTicks = Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
public BVirtualComponent() {
|
||||
this.this();
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$virtual$BVirtualComponent;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$virtual$BVirtualComponent = BVirtualComponent.class("[Ljavax.baja.virtual.BVirtualComponent;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
icon = BIcon.make(BIcon.std("object.png"), BIcon.std("badges/ghost.png"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.virtual;
|
||||
|
||||
import javax.baja.naming.BHost;
|
||||
import javax.baja.naming.BISession;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.LexiconText;
|
||||
import javax.baja.virtual.BVirtualComponent;
|
||||
import javax.baja.virtual.BVirtualGateway;
|
||||
import javax.baja.virtual.VirtualCacheCallbacks;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class BVirtualComponentSpace
|
||||
extends BComponentSpace {
|
||||
public static final Type TYPE;
|
||||
VirtualCacheCallbacks virtualCacheCallbacks;
|
||||
final BVirtualGateway gateway;
|
||||
boolean isRunning;
|
||||
Object lock;
|
||||
static /* synthetic */ Class class$javax$baja$virtual$BVirtualComponentSpace;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public final void start() {
|
||||
Object object = this.lock;
|
||||
synchronized (object) {
|
||||
if (this.isRunning) {
|
||||
return;
|
||||
}
|
||||
BComponent bComponent = this.getRootComponent();
|
||||
if (bComponent == null) {
|
||||
throw new IllegalStateException("Cannot start virtual space due to null root component.");
|
||||
}
|
||||
if (this.virtualCacheCallbacks == null) {
|
||||
throw new IllegalStateException("Cannot start virtual space due to null virtual cache callbacks.");
|
||||
}
|
||||
bComponent.start();
|
||||
this.virtualCacheCallbacks.start();
|
||||
this.isRunning = true;
|
||||
this.started();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void started() {
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public final void stop() {
|
||||
Object object = this.lock;
|
||||
synchronized (object) {
|
||||
if (!this.isRunning) {
|
||||
return;
|
||||
}
|
||||
this.virtualCacheCallbacks.stop();
|
||||
this.getRootComponent().stop();
|
||||
this.isRunning = false;
|
||||
this.stopped();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void stopped() {
|
||||
}
|
||||
|
||||
public final boolean isRunning() {
|
||||
return this.isRunning;
|
||||
}
|
||||
|
||||
public final BVirtualGateway getVirtualGateway() {
|
||||
return this.gateway;
|
||||
}
|
||||
|
||||
public final VirtualCacheCallbacks getVirtualCacheCallbacks() {
|
||||
return this.virtualCacheCallbacks;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public final void setVirtualCacheCallbacks(VirtualCacheCallbacks virtualCacheCallbacks) {
|
||||
Object object = this.lock;
|
||||
synchronized (object) {
|
||||
if (this.isRunning) {
|
||||
throw new IllegalStateException("Cannot set virtual cache callbacks because the virtual space is already running.");
|
||||
}
|
||||
this.virtualCacheCallbacks = virtualCacheCallbacks;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public final void setRootComponent(BComponent bComponent) {
|
||||
Object object = this.lock;
|
||||
synchronized (object) {
|
||||
if (this.isRunning) {
|
||||
throw new IllegalStateException("Cannot set root component because the virtual space is already running.");
|
||||
}
|
||||
super.setRootComponent(bComponent);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSpaceReadonly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public BHost getHost() {
|
||||
return this.gateway.getSpace().getHost();
|
||||
}
|
||||
|
||||
public BISession getSession() {
|
||||
return this.gateway.getSpace().getSession();
|
||||
}
|
||||
|
||||
public BOrd getAbsoluteOrd() {
|
||||
return BOrd.make(this.gateway.getAbsoluteOrd(), "virtual:");
|
||||
}
|
||||
|
||||
public BOrd getOrdInHost() {
|
||||
return BOrd.make(this.gateway.getOrdInHost(), "virtual:");
|
||||
}
|
||||
|
||||
public final BOrd getNavOrd() {
|
||||
return this.gateway.getNavOrd();
|
||||
}
|
||||
|
||||
public final BINavNode getNavParent() {
|
||||
return this.gateway;
|
||||
}
|
||||
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
spyWriter.startProps();
|
||||
spyWriter.trTitle("VirtualComponentSpace", 2);
|
||||
spyWriter.prop((Object)"isRunning", this.isRunning);
|
||||
spyWriter.endProps();
|
||||
if (this.virtualCacheCallbacks != null) {
|
||||
this.virtualCacheCallbacks.spy(spyWriter);
|
||||
}
|
||||
super.spy(spyWriter);
|
||||
BComponent bComponent = this.getRootComponent();
|
||||
if (bComponent != null) {
|
||||
spyWriter.startProps();
|
||||
spyWriter.trTitle("VirtualComponentSpace Root Component", 2);
|
||||
spyWriter.endProps();
|
||||
bComponent.spy(spyWriter);
|
||||
}
|
||||
}
|
||||
|
||||
public Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
if (n == 104 && this.gateway != null) {
|
||||
if (object instanceof SlotPath[]) {
|
||||
SlotPath[] slotPathArray = (SlotPath[])object;
|
||||
int n2 = slotPathArray.length;
|
||||
BOrd[] bOrdArray = new BOrd[n2];
|
||||
BOrd bOrd = this.getNavOrd();
|
||||
int n3 = 0;
|
||||
while (n3 < n2) {
|
||||
bOrdArray[n3] = BOrd.make(bOrd, slotPathArray[n3]).normalize();
|
||||
++n3;
|
||||
}
|
||||
this.gateway.ensureVirtualsLoaded(bOrdArray);
|
||||
} else {
|
||||
this.gateway.ensureVirtualsLoaded((BOrd[])object);
|
||||
}
|
||||
}
|
||||
if (n == 110) {
|
||||
this.touch((BOrd[])object);
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
void touch(BOrd[] bOrdArray) {
|
||||
if (bOrdArray == null) {
|
||||
return;
|
||||
}
|
||||
int n = 0;
|
||||
while (n < bOrdArray.length) {
|
||||
try {
|
||||
BObject bObject = bOrdArray[n].get(this);
|
||||
if (bObject instanceof BVirtualComponent) {
|
||||
((BVirtualComponent)bObject).updateTicks();
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.virtualCacheCallbacks = null;
|
||||
this.isRunning = false;
|
||||
this.lock = new Object();
|
||||
}
|
||||
|
||||
public BVirtualComponentSpace(String string, LexiconText lexiconText, BOrd bOrd, BVirtualGateway bVirtualGateway) {
|
||||
super(string, lexiconText, BOrd.make(bVirtualGateway.getOrdInSession(), "virtual:"));
|
||||
this.this();
|
||||
this.gateway = bVirtualGateway;
|
||||
this.setVirtualCacheCallbacks(new VirtualCacheCallbacks(this));
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$virtual$BVirtualComponentSpace;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$virtual$BVirtualComponentSpace = BVirtualComponentSpace.class("[Ljavax.baja.virtual.BVirtualComponentSpace;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.virtual;
|
||||
|
||||
import javax.baja.agent.AgentList;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.naming.BOrd;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.nav.BINavNode;
|
||||
import javax.baja.space.BComponentSpace;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BIcon;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.sys.Property;
|
||||
import javax.baja.sys.Slot;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.util.LexiconText;
|
||||
import javax.baja.virtual.BVirtualComponent;
|
||||
import javax.baja.virtual.BVirtualComponentSpace;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public abstract class BVirtualGateway
|
||||
extends BComponent {
|
||||
public static final Type TYPE;
|
||||
private static final BIcon icon;
|
||||
static final Log log;
|
||||
BComponentSpace space;
|
||||
static /* synthetic */ Class class$javax$baja$virtual$BVirtualGateway;
|
||||
|
||||
public Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public final BComponentSpace getVirtualSpace() {
|
||||
return this.space;
|
||||
}
|
||||
|
||||
protected BVirtualComponentSpace makeVirtualSpace() {
|
||||
BVirtualComponentSpace bVirtualComponentSpace = new BVirtualComponentSpace("virtual", LexiconText.make("baja", "nav.virtual"), BOrd.make("virtual:"), this);
|
||||
BVirtualComponent bVirtualComponent = this.makeVirtualRoot();
|
||||
if (bVirtualComponent == null) {
|
||||
throw new IllegalStateException("makeVirtualRoot() returned null. Must return a valid root component for the virtual space.");
|
||||
}
|
||||
bVirtualComponentSpace.setRootComponent(bVirtualComponent);
|
||||
return bVirtualComponentSpace;
|
||||
}
|
||||
|
||||
protected BVirtualComponent makeVirtualRoot() {
|
||||
return new BVirtualComponent();
|
||||
}
|
||||
|
||||
public Slot loadVirtualSlot(BVirtualComponent bVirtualComponent, String string) {
|
||||
String string2;
|
||||
String string3;
|
||||
if (bVirtualComponent == null) {
|
||||
return null;
|
||||
}
|
||||
Slot slot = null;
|
||||
if (string != null && (slot = bVirtualComponent.getSlot(string3 = SlotPath.escape(string))) == null && (slot = this.addVirtualSlot(bVirtualComponent, string)) != null && !(string2 = slot.getName()).equals(string3)) {
|
||||
log.warning("Name of virtual slot added is inconsistent: \"" + string2 + "\" was expected to be \"" + string3 + '\"');
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
|
||||
protected abstract Property addVirtualSlot(BVirtualComponent var1, String var2);
|
||||
|
||||
public abstract void loadVirtualSlots(BVirtualComponent var1);
|
||||
|
||||
public void ensureVirtualsLoaded(BOrd[] bOrdArray) {
|
||||
}
|
||||
|
||||
public final BOrd getNavOrd() {
|
||||
BOrd bOrd = super.getNavOrd();
|
||||
if (bOrd != null) {
|
||||
bOrd = BOrd.make(bOrd, "virtual:/");
|
||||
}
|
||||
return bOrd;
|
||||
}
|
||||
|
||||
public boolean hasNavChildren() {
|
||||
if (this.space != null) {
|
||||
return this.space.hasNavChildren();
|
||||
}
|
||||
return super.hasNavChildren();
|
||||
}
|
||||
|
||||
public BINavNode getNavChild(String string) {
|
||||
if (this.space != null) {
|
||||
return this.space.getNavChild(string);
|
||||
}
|
||||
return super.getNavChild(string);
|
||||
}
|
||||
|
||||
public BINavNode resolveNavChild(String string) {
|
||||
if (this.space != null) {
|
||||
return this.space.resolveNavChild(string);
|
||||
}
|
||||
return super.resolveNavChild(string);
|
||||
}
|
||||
|
||||
public BINavNode[] getNavChildren() {
|
||||
if (this.space != null) {
|
||||
return this.space.getNavChildren();
|
||||
}
|
||||
return super.getNavChildren();
|
||||
}
|
||||
|
||||
public AgentList getAgents(Context context) {
|
||||
AgentList agentList = super.getAgents(context);
|
||||
agentList.remove("pxEditor:PxEditor");
|
||||
agentList.remove("wiresheet:WireSheet");
|
||||
agentList.remove("workbench:LinkSheet");
|
||||
return agentList;
|
||||
}
|
||||
|
||||
public BIcon getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void spy(SpyWriter spyWriter) throws Exception {
|
||||
spyWriter.startProps();
|
||||
spyWriter.trTitle("VirtualSpace", 2);
|
||||
spyWriter.prop((Object)"virtualSpaceType", this.space != null ? this.space.getType() : null);
|
||||
spyWriter.endProps();
|
||||
if (this.space != null) {
|
||||
this.space.spy(spyWriter);
|
||||
}
|
||||
spyWriter.startProps();
|
||||
spyWriter.trTitle("VirtualGateway", 2);
|
||||
spyWriter.endProps();
|
||||
super.spy(spyWriter);
|
||||
}
|
||||
|
||||
public Object fw(int n, Object object, Object object2, Object object3, Object object4) {
|
||||
switch (n) {
|
||||
case 11: {
|
||||
this.fwStarted();
|
||||
break;
|
||||
}
|
||||
case 12: {
|
||||
this.fwStopped();
|
||||
break;
|
||||
}
|
||||
case 108: {
|
||||
this.setSpace((BComponentSpace)object);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.fw(n, object, object2, object3, object4);
|
||||
}
|
||||
|
||||
void fwStarted() {
|
||||
BVirtualComponentSpace bVirtualComponentSpace = this.makeVirtualSpace();
|
||||
this.setSpace(bVirtualComponentSpace);
|
||||
bVirtualComponentSpace.start();
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed back jump from a try to a catch block - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
void fwStopped() {
|
||||
if (this.space == null) return;
|
||||
try {
|
||||
if (this.space instanceof BVirtualComponentSpace) {
|
||||
((BVirtualComponentSpace)this.space).stop();
|
||||
}
|
||||
}
|
||||
catch (Throwable throwable) {
|
||||
Object var2_2 = null;
|
||||
this.space = null;
|
||||
throw throwable;
|
||||
}
|
||||
{
|
||||
Object var2_3 = null;
|
||||
this.space = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void setSpace(BComponentSpace bComponentSpace) {
|
||||
this.space = bComponentSpace;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$virtual$BVirtualGateway;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$virtual$BVirtualGateway = BVirtualGateway.class("[Ljavax.baja.virtual.BVirtualGateway;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
icon = BIcon.std("ghost.png");
|
||||
log = Log.getLog("virtual.gateway");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.virtual;
|
||||
|
||||
import javax.baja.naming.BSlotScheme;
|
||||
import javax.baja.naming.OrdQuery;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.virtual.VirtualPath;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public final class BVirtualScheme
|
||||
extends BSlotScheme {
|
||||
public static final BVirtualScheme INSTANCE = new BVirtualScheme();
|
||||
public static final Type TYPE;
|
||||
static /* synthetic */ Class class$javax$baja$virtual$BVirtualScheme;
|
||||
|
||||
public final OrdQuery parse(String string) {
|
||||
return new VirtualPath(this.getId(), string);
|
||||
}
|
||||
|
||||
public final Type getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private BVirtualScheme() {
|
||||
super("virtual");
|
||||
}
|
||||
|
||||
static {
|
||||
Class clazz = class$javax$baja$virtual$BVirtualScheme;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$virtual$BVirtualScheme = BVirtualScheme.class("[Ljavax.baja.virtual.BVirtualScheme;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,773 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*
|
||||
* Could not load the following classes:
|
||||
* javax.baja.nre.util.Array
|
||||
* javax.baja.nre.util.IntHashMap
|
||||
* javax.baja.nre.util.SortUtil
|
||||
*/
|
||||
package javax.baja.virtual;
|
||||
|
||||
import com.tridium.sys.schema.ComponentSlotMap;
|
||||
import java.util.HashMap;
|
||||
import javax.baja.log.Log;
|
||||
import javax.baja.nre.util.Array;
|
||||
import javax.baja.nre.util.IntHashMap;
|
||||
import javax.baja.nre.util.SortUtil;
|
||||
import javax.baja.spy.SpyWriter;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BComponent;
|
||||
import javax.baja.sys.BFacets;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.Clock;
|
||||
import javax.baja.sys.Context;
|
||||
import javax.baja.virtual.BVirtualComponent;
|
||||
import javax.baja.virtual.BVirtualComponentSpace;
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
public class VirtualCacheCallbacks {
|
||||
public static final BRelTime MAX_CACHE_LIFE = BRelTime.make(Long.getLong("niagara.virtual.cache.maxLifeDefault", 45000L));
|
||||
public static final BRelTime MIN_CACHE_LIFE = BRelTime.make(Long.getLong("niagara.virtual.cache.minLifeDefault", 25000L));
|
||||
public static final int VIRTUAL_THRESHOLD = Integer.getInteger("niagara.virtual.cache.threshold", 1000);
|
||||
public static final long VIRTUAL_THRESHOLD_SCAN_RATE = Long.getLong("niagara.virtual.cache.thresholdScanRate", 1000L);
|
||||
public static final int THREAD_POOL_SIZE = Integer.getInteger("niagara.virtual.cache.threadPoolSize", 10);
|
||||
public static final int SPACES_PER_THREAD = Integer.getInteger("niagara.virtual.cache.spacesPerThread", 5);
|
||||
static VirtualCleanupThread[] vcThreadPool = new VirtualCleanupThread[THREAD_POOL_SIZE];
|
||||
static VirtualThresholdThread vThresholdThread = null;
|
||||
static Context virtualRemoveContext = BFacets.make("virtualCacheRemove", BBoolean.TRUE);
|
||||
static final Log log = Log.getLog("virtual.cache");
|
||||
BVirtualComponentSpace space;
|
||||
static /* synthetic */ Class class$javax$baja$virtual$VirtualCacheCallbacks$VirtualComponentInfo;
|
||||
|
||||
public synchronized void start() {
|
||||
if (vThresholdThread == null) {
|
||||
vThresholdThread = new VirtualThresholdThread();
|
||||
vThresholdThread.start();
|
||||
if (log.isTraceOn()) {
|
||||
log.trace("Virtual:Threshold Thread started");
|
||||
}
|
||||
}
|
||||
vThresholdThread.register(this.space, this);
|
||||
int n = Integer.MAX_VALUE;
|
||||
int n2 = 0;
|
||||
int n3 = 0;
|
||||
while (n3 < THREAD_POOL_SIZE) {
|
||||
int n4;
|
||||
if (vcThreadPool[n3] == null) {
|
||||
VirtualCacheCallbacks.vcThreadPool[n3] = new VirtualCleanupThread(n3);
|
||||
vcThreadPool[n3].start();
|
||||
if (log.isTraceOn()) {
|
||||
log.trace("Virtual:Cleanup" + n3 + " Thread started");
|
||||
}
|
||||
}
|
||||
if ((n4 = vcThreadPool[n3].size()) < SPACES_PER_THREAD) {
|
||||
vcThreadPool[n3].register(this.space, this);
|
||||
return;
|
||||
}
|
||||
if (n4 < n) {
|
||||
n = n4;
|
||||
n2 = n3;
|
||||
}
|
||||
++n3;
|
||||
}
|
||||
vcThreadPool[n2].register(this.space, this);
|
||||
}
|
||||
|
||||
public synchronized void stop() {
|
||||
int n = 0;
|
||||
while (n < THREAD_POOL_SIZE) {
|
||||
if (vcThreadPool[n] != null && vcThreadPool[n].contains(this.space)) {
|
||||
if (vcThreadPool[n].unregister(this.space) > 0) break;
|
||||
vcThreadPool[n].kill();
|
||||
VirtualCacheCallbacks.vcThreadPool[n] = null;
|
||||
if (!log.isTraceOn()) break;
|
||||
log.trace("Virtual:Cleanup" + n + " Thread stopped");
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
if (vThresholdThread != null && vThresholdThread.unregister(this.space) <= 0) {
|
||||
vThresholdThread.kill();
|
||||
vThresholdThread = null;
|
||||
if (log.isTraceOn()) {
|
||||
log.trace("Virtual:Threshold Thread stopped");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BRelTime getMaxVirtualCacheLife() {
|
||||
return MAX_CACHE_LIFE;
|
||||
}
|
||||
|
||||
public BRelTime getMinVirtualCacheLife() {
|
||||
return MIN_CACHE_LIFE;
|
||||
}
|
||||
|
||||
public BVirtualComponentSpace getSpace() {
|
||||
return this.space;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Unable to fully structure code
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void spy(SpyWriter var1_1) throws Exception {
|
||||
var1_1.startProps();
|
||||
var1_1.trTitle("VirtualCacheCallbacks", 2);
|
||||
var1_1.prop((Object)"MAX_CACHE_LIFE", VirtualCacheCallbacks.MAX_CACHE_LIFE);
|
||||
var1_1.prop((Object)"MIN_CACHE_LIFE", VirtualCacheCallbacks.MIN_CACHE_LIFE);
|
||||
var1_1.prop((Object)"THREAD_POOL_SIZE", VirtualCacheCallbacks.THREAD_POOL_SIZE);
|
||||
var1_1.prop((Object)"SPACES_PER_THREAD", VirtualCacheCallbacks.SPACES_PER_THREAD);
|
||||
var1_1.prop((Object)"VIRTUAL_THRESHOLD", VirtualCacheCallbacks.VIRTUAL_THRESHOLD);
|
||||
if (VirtualCacheCallbacks.VIRTUAL_THRESHOLD_SCAN_RATE <= 0L) {
|
||||
var1_1.prop((Object)"VIRTUAL_THRESHOLD_SCAN_RATE", VirtualCacheCallbacks.VIRTUAL_THRESHOLD_SCAN_RATE + " (disabled)");
|
||||
} else {
|
||||
var1_1.prop((Object)"VIRTUAL_THRESHOLD_SCAN_RATE", VirtualCacheCallbacks.VIRTUAL_THRESHOLD_SCAN_RATE + " (" + BRelTime.make(VirtualCacheCallbacks.VIRTUAL_THRESHOLD_SCAN_RATE) + ')');
|
||||
}
|
||||
var1_1.prop((Object)"maxVirtualCacheLife", this.getMaxVirtualCacheLife());
|
||||
var1_1.prop((Object)"minVirtualCacheLife", this.getMinVirtualCacheLife());
|
||||
var1_1.prop((Object)"vThresholdThread", VirtualCacheCallbacks.vThresholdThread.toString());
|
||||
var1_1.prop((Object)"__totalSpacesManaged", "" + VirtualCacheCallbacks.vThresholdThread.size());
|
||||
var2_2 = VirtualCacheCallbacks.vThresholdThread;
|
||||
synchronized (var2_2) {
|
||||
var1_1.prop((Object)"__numScans", "" + VirtualCacheCallbacks.vThresholdThread.numScans);
|
||||
var1_1.prop((Object)"__lastScanTicks", VirtualCacheCallbacks.vThresholdThread.lastScanTicks + " (" + BRelTime.make(VirtualCacheCallbacks.vThresholdThread.lastScanTicks) + ')');
|
||||
var1_1.prop((Object)"__minScanTicks", VirtualCacheCallbacks.vThresholdThread.minScanTicks + " (" + BRelTime.make(VirtualCacheCallbacks.vThresholdThread.minScanTicks) + ')');
|
||||
var1_1.prop((Object)"__maxScanTicks", VirtualCacheCallbacks.vThresholdThread.maxScanTicks + " (" + BRelTime.make(VirtualCacheCallbacks.vThresholdThread.maxScanTicks) + ')');
|
||||
if (VirtualCacheCallbacks.vThresholdThread.numScans > 0L) {
|
||||
var4_3 = (double)VirtualCacheCallbacks.vThresholdThread.sumScanTicks / (double)VirtualCacheCallbacks.vThresholdThread.numScans;
|
||||
var1_1.prop((Object)"__avgScanTicks", var4_3 + " (" + BRelTime.make((long)var4_3) + ')');
|
||||
}
|
||||
// MONITOREXIT @DISABLED, blocks:[0, 3] lbl44 : MonitorExitStatement: MONITOREXIT : var2_2
|
||||
var4_4 = 0;
|
||||
if (true) ** GOTO lbl103
|
||||
}
|
||||
do {
|
||||
block19: {
|
||||
block18: {
|
||||
if (VirtualCacheCallbacks.vcThreadPool[var4_4] == null) break block19;
|
||||
var1_1.prop((Object)("Thread '" + VirtualCacheCallbacks.vcThreadPool[var4_4].getName() + '\''), "Spaces managed: " + VirtualCacheCallbacks.vcThreadPool[var4_4].size() + (VirtualCacheCallbacks.vcThreadPool[var4_4].contains(this.space) != false ? " (includes this space)" : ""));
|
||||
var5_5 = new StringBuffer();
|
||||
var6_6 = null;
|
||||
var7_7 = VirtualCacheCallbacks.vcThreadPool[var4_4].map;
|
||||
synchronized (var7_7) {
|
||||
var6_6 = VirtualCacheCallbacks.vcThreadPool[var4_4].map.values().toArray(new VirtualCacheCallbacks[VirtualCacheCallbacks.vcThreadPool[var4_4].map.size()]);
|
||||
// MONITOREXIT @DISABLED, blocks:[1, 4, 9] lbl60 : MonitorExitStatement: MONITOREXIT : var7_7
|
||||
if (var6_6 == null) break block18;
|
||||
var9_8 = 0;
|
||||
if (true) ** GOTO lbl73
|
||||
}
|
||||
do {
|
||||
if ((var10_11 = var6_6[var9_8].space.getVirtualGateway()) != null) {
|
||||
if (var9_8 > 0) {
|
||||
var5_5.append("; ");
|
||||
}
|
||||
var5_5.append(var10_11.getSlotPath().getBody());
|
||||
}
|
||||
++var9_8;
|
||||
lbl73:
|
||||
// 2 sources
|
||||
|
||||
} while (var9_8 < var6_6.length);
|
||||
}
|
||||
var1_1.prop((Object)"__spaces", var5_5.toString());
|
||||
var7_7 = VirtualCacheCallbacks.vcThreadPool[var4_4];
|
||||
synchronized (var7_7) {
|
||||
var1_1.prop((Object)"__numScans", "" + VirtualCacheCallbacks.vcThreadPool[var4_4].numScans);
|
||||
var1_1.prop((Object)"__lastScanTicks", VirtualCacheCallbacks.vcThreadPool[var4_4].lastScanTicks + " (" + BRelTime.make(VirtualCacheCallbacks.vcThreadPool[var4_4].lastScanTicks) + ')');
|
||||
var1_1.prop((Object)"__minScanTicks", VirtualCacheCallbacks.vcThreadPool[var4_4].minScanTicks + " (" + BRelTime.make(VirtualCacheCallbacks.vcThreadPool[var4_4].minScanTicks) + ')');
|
||||
var1_1.prop((Object)"__maxScanTicks", VirtualCacheCallbacks.vcThreadPool[var4_4].maxScanTicks + " (" + BRelTime.make(VirtualCacheCallbacks.vcThreadPool[var4_4].maxScanTicks) + ')');
|
||||
if (VirtualCacheCallbacks.vcThreadPool[var4_4].numScans > 0L) {
|
||||
var9_9 = (double)VirtualCacheCallbacks.vcThreadPool[var4_4].sumScanTicks / (double)VirtualCacheCallbacks.vcThreadPool[var4_4].numScans;
|
||||
var1_1.prop((Object)"__avgScanTicks", var9_9 + " (" + BRelTime.make((long)var9_9) + ')');
|
||||
}
|
||||
var1_1.prop((Object)"__lastSleepTicks", VirtualCacheCallbacks.vcThreadPool[var4_4].lastSleepTicks + " (" + BRelTime.make(VirtualCacheCallbacks.vcThreadPool[var4_4].lastSleepTicks) + ')');
|
||||
if (VirtualCacheCallbacks.vcThreadPool[var4_4].numScans > 0L) {
|
||||
var9_10 = (double)VirtualCacheCallbacks.vcThreadPool[var4_4].sumSleepTicks / (double)VirtualCacheCallbacks.vcThreadPool[var4_4].numScans;
|
||||
var1_1.prop((Object)"__avgSleepTicks", var9_10 + " (" + BRelTime.make((long)var9_10) + ')');
|
||||
}
|
||||
}
|
||||
}
|
||||
++var4_4;
|
||||
lbl103:
|
||||
// 2 sources
|
||||
|
||||
} while (var4_4 < VirtualCacheCallbacks.THREAD_POOL_SIZE);
|
||||
var1_1.endProps();
|
||||
}
|
||||
|
||||
private static final VirtualChildInfo cleanupExpiredVirtuals(BComponent bComponent, BComponent bComponent2, long l) {
|
||||
BComponent[] bComponentArray;
|
||||
long l2 = -1;
|
||||
boolean bl = false;
|
||||
if (bComponent2 != null && (bComponentArray = bComponent2.getChildComponents()) != null) {
|
||||
int n = 0;
|
||||
while (n < bComponentArray.length) {
|
||||
BComponent bComponent3 = bComponentArray[n];
|
||||
VirtualChildInfo virtualChildInfo = VirtualCacheCallbacks.cleanupExpiredVirtuals(bComponent, bComponent3, l);
|
||||
long l3 = virtualChildInfo.cleanupTicks;
|
||||
bl |= virtualChildInfo.hasActiveChildren;
|
||||
if (l3 >= 0L) {
|
||||
long l4 = l2 = l2 < 0L ? l3 : Math.min(l2, l3);
|
||||
}
|
||||
if (!bComponent3.isSubscribed()) {
|
||||
if (bComponent3 != bComponent && bComponent3 instanceof BVirtualComponent && ((BVirtualComponent)bComponent3).performAutoRemoval() && !virtualChildInfo.hasActiveChildren) {
|
||||
long l5 = Clock.ticks() - ((BVirtualComponent)bComponent3).getLastActiveTicks();
|
||||
if (l5 >= l) {
|
||||
try {
|
||||
BComponent bComponent4 = bComponent3.getParent().asComponent();
|
||||
if (bComponent4 != null) {
|
||||
if (log.isTraceOn()) {
|
||||
log.trace("Virtual cache max life expired, auto removing " + bComponent3.getNavOrd());
|
||||
}
|
||||
bComponent4.remove(bComponent3.getPropertyInParent(), virtualRemoveContext);
|
||||
((ComponentSlotMap)bComponent4.fw(1)).setBrokerPropsLoaded(false);
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
} else if (l5 >= 0L) {
|
||||
long l6 = l - l5;
|
||||
l2 = l2 < 0L ? l6 : Math.min(l6, l2);
|
||||
bl = true;
|
||||
}
|
||||
} else if (bComponent3 instanceof BVirtualComponent) {
|
||||
bl = true;
|
||||
}
|
||||
} else {
|
||||
bl = true;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
return new VirtualChildInfo(l2, bl);
|
||||
}
|
||||
|
||||
private static final VirtualThresholdInfo mapVirtualsIntoTierBuckets(IntHashMap intHashMap, BComponent bComponent, BComponent bComponent2, long l) {
|
||||
Object object;
|
||||
int n = 0;
|
||||
int n2 = 0;
|
||||
if (bComponent2 != null && (object = bComponent2.getChildComponents()) != null && ((BComponent[])object).length > 0) {
|
||||
++n;
|
||||
int n3 = 0;
|
||||
int n4 = 0;
|
||||
while (n4 < ((BComponent[])object).length) {
|
||||
BComponent bComponent3 = object[n4];
|
||||
VirtualThresholdInfo virtualThresholdInfo = VirtualCacheCallbacks.mapVirtualsIntoTierBuckets(intHashMap, bComponent, bComponent3, l);
|
||||
n3 = Math.max(n3, virtualThresholdInfo.tier);
|
||||
n2 += virtualThresholdInfo.size;
|
||||
++n4;
|
||||
}
|
||||
n += n3;
|
||||
}
|
||||
if (bComponent2 instanceof BVirtualComponent && bComponent2 != bComponent) {
|
||||
object = (BVirtualComponent)bComponent2;
|
||||
++n2;
|
||||
Array array = (Array)intHashMap.get(n);
|
||||
if (array == null) {
|
||||
Class clazz = class$javax$baja$virtual$VirtualCacheCallbacks$VirtualComponentInfo;
|
||||
if (clazz == null) {
|
||||
clazz = class$javax$baja$virtual$VirtualCacheCallbacks$VirtualComponentInfo = VirtualCacheCallbacks.class("[Ljavax.baja.virtual.VirtualCacheCallbacks$VirtualComponentInfo;", false);
|
||||
}
|
||||
array = new Array(clazz);
|
||||
intHashMap.put(n, (Object)array);
|
||||
}
|
||||
array.add((Object)new VirtualComponentInfo((BVirtualComponent)object, l));
|
||||
}
|
||||
return new VirtualThresholdInfo(n, n2);
|
||||
}
|
||||
|
||||
static final /* synthetic */ VirtualThresholdInfo access$1(IntHashMap intHashMap, BComponent bComponent, BComponent bComponent2, long l) {
|
||||
return VirtualCacheCallbacks.mapVirtualsIntoTierBuckets(intHashMap, bComponent, bComponent2, l);
|
||||
}
|
||||
|
||||
static /* synthetic */ Class class(String string, boolean bl) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(string);
|
||||
if (!bl) {
|
||||
clazz = clazz.getComponentType();
|
||||
}
|
||||
return clazz;
|
||||
}
|
||||
catch (ClassNotFoundException classNotFoundException) {
|
||||
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public VirtualCacheCallbacks(BVirtualComponentSpace bVirtualComponentSpace) {
|
||||
this.space = bVirtualComponentSpace;
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class VirtualThresholdThread
|
||||
extends Thread {
|
||||
boolean alive;
|
||||
HashMap map;
|
||||
long lastScanTicks;
|
||||
long minScanTicks;
|
||||
long maxScanTicks;
|
||||
long sumScanTicks;
|
||||
long numScans;
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
void kill() {
|
||||
VirtualThresholdThread virtualThresholdThread = this;
|
||||
synchronized (virtualThresholdThread) {
|
||||
if (this.alive) {
|
||||
this.alive = false;
|
||||
this.interrupt();
|
||||
try {
|
||||
this.wait(5000L);
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
void register(BVirtualComponentSpace bVirtualComponentSpace, VirtualCacheCallbacks virtualCacheCallbacks) {
|
||||
if (log.isTraceOn()) {
|
||||
log.trace(this.getName() + " registering " + bVirtualComponentSpace.getNavOrd());
|
||||
}
|
||||
HashMap hashMap = this.map;
|
||||
synchronized (hashMap) {
|
||||
this.map.put(bVirtualComponentSpace, virtualCacheCallbacks);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
int unregister(BVirtualComponentSpace bVirtualComponentSpace) {
|
||||
if (log.isTraceOn()) {
|
||||
log.trace(this.getName() + " unregistering " + bVirtualComponentSpace.getNavOrd());
|
||||
}
|
||||
HashMap hashMap = this.map;
|
||||
synchronized (hashMap) {
|
||||
this.map.remove(bVirtualComponentSpace);
|
||||
return this.map.size();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
int size() {
|
||||
HashMap hashMap = this.map;
|
||||
synchronized (hashMap) {
|
||||
return this.map.size();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
boolean contains(BVirtualComponentSpace bVirtualComponentSpace) {
|
||||
HashMap hashMap = this.map;
|
||||
synchronized (hashMap) {
|
||||
return this.map.containsKey(bVirtualComponentSpace);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Unable to fully structure code
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void run() {
|
||||
if (VirtualCacheCallbacks.VIRTUAL_THRESHOLD_SCAN_RATE > 0L) ** GOTO lbl116
|
||||
return;
|
||||
lbl-1000:
|
||||
// 1 sources
|
||||
|
||||
{
|
||||
block25: {
|
||||
try {
|
||||
var1_1 = Clock.ticks();
|
||||
var3_4 = null;
|
||||
var4_5 = this.map;
|
||||
synchronized (var4_5) {
|
||||
var3_4 = this.map.values().toArray(new VirtualCacheCallbacks[this.map.size()]);
|
||||
// MONITOREXIT @DISABLED, blocks:[0, 1, 6, 14] lbl10 : MonitorExitStatement: MONITOREXIT : var4_5
|
||||
if (var3_4 == null) break block25;
|
||||
}
|
||||
var6_6 = new IntHashMap();
|
||||
var7_7 = -1;
|
||||
var8_8 = 0;
|
||||
var9_9 = 0;
|
||||
while (true) {
|
||||
block27: {
|
||||
if (var9_9 < var3_4.length) break block27;
|
||||
var9_9 = var8_8 - VirtualCacheCallbacks.VIRTUAL_THRESHOLD;
|
||||
if (var9_9 <= 0 || var7_7 < 0) break block25;
|
||||
var10_11 = 0;
|
||||
if (true) ** GOTO lbl102
|
||||
}
|
||||
var10_10 = var3_4[var9_9].space.getRootComponent();
|
||||
var11_12 = VirtualCacheCallbacks.access$1(var6_6, var10_10, var10_10, var3_4[var9_9].getMinVirtualCacheLife().getMillis());
|
||||
var8_8 += var11_12.size;
|
||||
var7_7 = Math.max(var11_12.tier, var7_7);
|
||||
++var9_9;
|
||||
}
|
||||
}
|
||||
catch (InterruptedException v1) {
|
||||
continue;
|
||||
}
|
||||
catch (Exception var1_2) {
|
||||
var1_2.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
do {
|
||||
var11_12 = (Array)var6_6.get(var10_11);
|
||||
var12_13 = (VirtualComponentInfo[])var11_12.trim();
|
||||
var13_14 = var12_13.length;
|
||||
var14_15 = new Long[var13_14];
|
||||
var15_16 = 0;
|
||||
while (var15_16 < var13_14) {
|
||||
var16_17 = -1;
|
||||
if (!var12_13[var15_16].vComp.isSubscribed() && var12_13[var15_16].vComp.performAutoRemoval() && (var18_20 = Clock.ticks() - var12_13[var15_16].vComp.getLastActiveTicks()) >= var12_13[var15_16].minLife && ((var20_21 = var12_13[var15_16].vComp.getChildComponents()) == null || var20_21.length == 0)) {
|
||||
var16_17 = var12_13[var15_16].vComp.getLastActiveTicks();
|
||||
}
|
||||
var14_15[var15_16] = new Long(var16_17);
|
||||
++var15_16;
|
||||
}
|
||||
SortUtil.sort((Object[])var14_15, (Object[])var12_13);
|
||||
var15_16 = 0;
|
||||
while (var15_16 < var12_13.length) {
|
||||
block26: {
|
||||
if (var14_15[var15_16].longValue() < 0L || !var12_13[var15_16].vComp.isRunning()) break block26;
|
||||
try {
|
||||
var16_18 = var12_13[var15_16].vComp.getParent().asComponent();
|
||||
if (var16_18 == null) break block26;
|
||||
if (VirtualCacheCallbacks.log.isTraceOn()) {
|
||||
VirtualCacheCallbacks.log.trace("Virtual cache min life expired, auto removing " + var12_13[var15_16].vComp.getNavOrd());
|
||||
}
|
||||
var16_18.remove(var12_13[var15_16].vComp.getPropertyInParent(), VirtualCacheCallbacks.virtualRemoveContext);
|
||||
((ComponentSlotMap)var16_18.fw(1)).setBrokerPropsLoaded(false);
|
||||
if (--var9_9 <= 0) break;
|
||||
var17_19 = var16_18.getChildComponents();
|
||||
if (!(var16_18 instanceof BVirtualComponent) || var16_18.isSubscribed() || !((BVirtualComponent)var16_18).performAutoRemoval() || var17_19 != null && var17_19.length != 0 || (var18_20 = Clock.ticks() - ((BVirtualComponent)var16_18).getLastActiveTicks()) < var12_13[var15_16].minLife) break block26;
|
||||
var20_22 = var12_13.length;
|
||||
var21_23 = var20_22 + 1;
|
||||
var22_24 = ((BVirtualComponent)var16_18).getLastActiveTicks();
|
||||
var24_26 = var15_16 + 1;
|
||||
while (var24_26 < var12_13.length) {
|
||||
if (var14_15[var24_26].longValue() > var22_24) {
|
||||
var20_22 = var24_26;
|
||||
break;
|
||||
}
|
||||
++var24_26;
|
||||
}
|
||||
var24_25 = new VirtualComponentInfo[var21_23];
|
||||
var25_27 = new Long[var21_23];
|
||||
var26_28 = 0;
|
||||
while (true) {
|
||||
block28: {
|
||||
if (var26_28 < var20_22) break block28;
|
||||
var24_25[var20_22] = new VirtualComponentInfo((BVirtualComponent)var16_18, var12_13[var15_16].minLife);
|
||||
var25_27[var20_22] = new Long(var22_24);
|
||||
var26_28 = var20_22;
|
||||
if (true) ** GOTO lbl94
|
||||
}
|
||||
var24_25[var26_28] = var12_13[var26_28];
|
||||
var25_27[var26_28] = var14_15[var26_28];
|
||||
++var26_28;
|
||||
}
|
||||
}
|
||||
catch (Exception v2) {}
|
||||
break block26;
|
||||
do {
|
||||
var24_25[var26_28 + 1] = var12_13[var26_28];
|
||||
var25_27[var26_28 + 1] = var14_15[var26_28];
|
||||
++var26_28;
|
||||
lbl94:
|
||||
// 2 sources
|
||||
|
||||
} while (var26_28 < var21_23 - 1);
|
||||
var12_13 = var24_25;
|
||||
var14_15 = var25_27;
|
||||
}
|
||||
++var15_16;
|
||||
}
|
||||
if (var9_9 <= 0) break;
|
||||
++var10_11;
|
||||
lbl102:
|
||||
// 2 sources
|
||||
|
||||
} while (var10_11 < var7_7);
|
||||
}
|
||||
var4_5 = this;
|
||||
synchronized (var4_5) {
|
||||
this.lastScanTicks = Clock.ticks() - var1_1;
|
||||
this.minScanTicks = Math.min(this.lastScanTicks, this.minScanTicks);
|
||||
this.maxScanTicks = Math.max(this.lastScanTicks, this.maxScanTicks);
|
||||
this.sumScanTicks += this.lastScanTicks;
|
||||
++this.numScans;
|
||||
}
|
||||
Thread.sleep(VirtualCacheCallbacks.VIRTUAL_THRESHOLD_SCAN_RATE);
|
||||
lbl116:
|
||||
// 4 sources
|
||||
|
||||
** while (this.alive)
|
||||
}
|
||||
lbl117:
|
||||
// 1 sources
|
||||
|
||||
var1_3 = this;
|
||||
synchronized (var1_3) {
|
||||
this.notifyAll();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.alive = true;
|
||||
this.map = new HashMap();
|
||||
this.lastScanTicks = 0L;
|
||||
this.minScanTicks = Long.MAX_VALUE;
|
||||
this.maxScanTicks = Long.MIN_VALUE;
|
||||
this.sumScanTicks = 0L;
|
||||
this.numScans = 0L;
|
||||
}
|
||||
|
||||
VirtualThresholdThread() {
|
||||
super("Virtual:Threshold");
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Illegal identifiers - consider using --renameillegalidents true
|
||||
*/
|
||||
class VirtualCleanupThread
|
||||
extends Thread {
|
||||
boolean alive;
|
||||
HashMap map;
|
||||
long lastScanTicks;
|
||||
long minScanTicks;
|
||||
long maxScanTicks;
|
||||
long sumScanTicks;
|
||||
long numScans;
|
||||
long lastSleepTicks;
|
||||
long sumSleepTicks;
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
void kill() {
|
||||
VirtualCleanupThread virtualCleanupThread = this;
|
||||
synchronized (virtualCleanupThread) {
|
||||
if (this.alive) {
|
||||
this.alive = false;
|
||||
this.interrupt();
|
||||
try {
|
||||
this.wait(5000L);
|
||||
}
|
||||
catch (Exception exception) {}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
void register(BVirtualComponentSpace bVirtualComponentSpace, VirtualCacheCallbacks virtualCacheCallbacks) {
|
||||
if (log.isTraceOn()) {
|
||||
log.trace(this.getName() + " registering " + bVirtualComponentSpace.getNavOrd());
|
||||
}
|
||||
HashMap hashMap = this.map;
|
||||
synchronized (hashMap) {
|
||||
this.map.put(bVirtualComponentSpace, virtualCacheCallbacks);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
int unregister(BVirtualComponentSpace bVirtualComponentSpace) {
|
||||
if (log.isTraceOn()) {
|
||||
log.trace(this.getName() + " unregistering " + bVirtualComponentSpace.getNavOrd());
|
||||
}
|
||||
HashMap hashMap = this.map;
|
||||
synchronized (hashMap) {
|
||||
this.map.remove(bVirtualComponentSpace);
|
||||
return this.map.size();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
int size() {
|
||||
HashMap hashMap = this.map;
|
||||
synchronized (hashMap) {
|
||||
return this.map.size();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
boolean contains(BVirtualComponentSpace bVirtualComponentSpace) {
|
||||
HashMap hashMap = this.map;
|
||||
synchronized (hashMap) {
|
||||
return this.map.containsKey(bVirtualComponentSpace);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING - Removed try catching itself - possible behaviour change.
|
||||
* Enabled aggressive block sorting
|
||||
* Enabled unnecessary exception pruning
|
||||
* Enabled aggressive exception aggregation
|
||||
*/
|
||||
public void run() {
|
||||
long l = 1000L;
|
||||
while (this.alive) {
|
||||
try {
|
||||
long l2 = Clock.ticks();
|
||||
VirtualCacheCallbacks[] virtualCacheCallbacksArray = null;
|
||||
Object object = this.map;
|
||||
synchronized (object) {
|
||||
virtualCacheCallbacksArray = this.map.values().toArray(new VirtualCacheCallbacks[this.map.size()]);
|
||||
}
|
||||
long l3 = -1;
|
||||
if (virtualCacheCallbacksArray != null) {
|
||||
int n = 0;
|
||||
while (n < virtualCacheCallbacksArray.length) {
|
||||
BComponent bComponent = virtualCacheCallbacksArray[n].space.getRootComponent();
|
||||
long l4 = virtualCacheCallbacksArray[n].getMaxVirtualCacheLife().getMillis();
|
||||
l = n > 0 ? Math.min(l4, l) : l4;
|
||||
VirtualChildInfo virtualChildInfo = VirtualCacheCallbacks.cleanupExpiredVirtuals(bComponent, bComponent, l4);
|
||||
long l5 = virtualChildInfo.cleanupTicks;
|
||||
if (l5 >= 0L) {
|
||||
l3 = l3 >= 0L ? Math.min(l3, l5) : l5;
|
||||
} else if (!virtualChildInfo.hasActiveChildren) {
|
||||
((ComponentSlotMap)bComponent.fw(1)).setBrokerPropsLoaded(false);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
}
|
||||
if (l3 >= 0L) {
|
||||
l = l3 + 1000L;
|
||||
}
|
||||
object = this;
|
||||
synchronized (object) {
|
||||
this.lastScanTicks = Clock.ticks() - l2;
|
||||
this.minScanTicks = Math.min(this.lastScanTicks, this.minScanTicks);
|
||||
this.maxScanTicks = Math.max(this.lastScanTicks, this.maxScanTicks);
|
||||
this.sumScanTicks += this.lastScanTicks;
|
||||
this.lastSleepTicks = l;
|
||||
this.sumSleepTicks += this.lastSleepTicks;
|
||||
++this.numScans;
|
||||
}
|
||||
Thread.sleep(l);
|
||||
}
|
||||
catch (InterruptedException interruptedException) {
|
||||
}
|
||||
catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
VirtualCleanupThread virtualCleanupThread = this;
|
||||
synchronized (virtualCleanupThread) {
|
||||
this.notifyAll();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private final /* synthetic */ void this() {
|
||||
this.alive = true;
|
||||
this.map = new HashMap();
|
||||
this.lastScanTicks = 0L;
|
||||
this.minScanTicks = Long.MAX_VALUE;
|
||||
this.maxScanTicks = Long.MIN_VALUE;
|
||||
this.sumScanTicks = 0L;
|
||||
this.numScans = 0L;
|
||||
this.lastSleepTicks = 0L;
|
||||
this.sumSleepTicks = 0L;
|
||||
}
|
||||
|
||||
VirtualCleanupThread(int n) {
|
||||
super("Virtual:Cleanup" + n);
|
||||
this.this();
|
||||
}
|
||||
}
|
||||
|
||||
static class VirtualChildInfo {
|
||||
long cleanupTicks;
|
||||
boolean hasActiveChildren;
|
||||
|
||||
VirtualChildInfo(long l, boolean bl) {
|
||||
this.cleanupTicks = l;
|
||||
this.hasActiveChildren = bl;
|
||||
}
|
||||
}
|
||||
|
||||
static class VirtualThresholdInfo {
|
||||
int tier;
|
||||
int size;
|
||||
|
||||
VirtualThresholdInfo(int n, int n2) {
|
||||
this.tier = n;
|
||||
this.size = n2;
|
||||
}
|
||||
}
|
||||
|
||||
static class VirtualComponentInfo {
|
||||
BVirtualComponent vComp;
|
||||
long minLife;
|
||||
|
||||
VirtualComponentInfo(BVirtualComponent bVirtualComponent, long l) {
|
||||
this.vComp = bVirtualComponent;
|
||||
this.minLife = l;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.virtual;
|
||||
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.naming.SyntaxException;
|
||||
import javax.baja.sys.IllegalNameException;
|
||||
|
||||
public final class VirtualPath
|
||||
extends SlotPath {
|
||||
public static final VirtualPath convertFromSlotPath(SlotPath slotPath) {
|
||||
String[] stringArray = slotPath.getNames();
|
||||
int n = stringArray.length;
|
||||
String[] stringArray2 = new String[n];
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
stringArray2[n2] = SlotPath.unescape(stringArray[n2]);
|
||||
++n2;
|
||||
}
|
||||
if (slotPath.isAbsolute()) {
|
||||
return new VirtualPath("virtual", stringArray2);
|
||||
}
|
||||
n2 = slotPath.getBackupDepth();
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
int n3 = 0;
|
||||
while (n3 < n2) {
|
||||
stringBuffer.append("../");
|
||||
++n3;
|
||||
}
|
||||
n3 = 0;
|
||||
while (n3 < n) {
|
||||
if (n3 != 0) {
|
||||
stringBuffer.append("/");
|
||||
}
|
||||
stringBuffer.append(stringArray2[n3]);
|
||||
++n3;
|
||||
}
|
||||
return new VirtualPath(stringBuffer.toString());
|
||||
}
|
||||
|
||||
protected final SlotPath makeSlotPath(String string, String string2) {
|
||||
return new VirtualPath(string, string2);
|
||||
}
|
||||
|
||||
protected final boolean isValidPathName(String string) {
|
||||
return VirtualPath.isValidName(string);
|
||||
}
|
||||
|
||||
public static final boolean isValidName(String string) {
|
||||
if (string == null) {
|
||||
return false;
|
||||
}
|
||||
int n = string.length();
|
||||
if (n < 1) {
|
||||
return false;
|
||||
}
|
||||
int n2 = 0;
|
||||
while (n2 < n) {
|
||||
char c = string.charAt(n2);
|
||||
switch (c) {
|
||||
case '$':
|
||||
case '/':
|
||||
case ':':
|
||||
case '|': {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
++n2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final void verifyValidName(String string) {
|
||||
if (!VirtualPath.isValidName(string)) {
|
||||
throw new IllegalNameException("baja", "IllegalNameException.name", new Object[]{string});
|
||||
}
|
||||
}
|
||||
|
||||
public static final String escape(String string) {
|
||||
throw new UnsupportedOperationException("escape() not implemented for VirtualPath.");
|
||||
}
|
||||
|
||||
public static final String unescape(String string) {
|
||||
throw new UnsupportedOperationException("unescape() not implemented for VirtualPath.");
|
||||
}
|
||||
|
||||
public final String toDisplayString() {
|
||||
return this.getBody();
|
||||
}
|
||||
|
||||
public VirtualPath(String string, String string2) throws SyntaxException {
|
||||
super(string, string2);
|
||||
}
|
||||
|
||||
public VirtualPath(String string, String[] stringArray) throws SyntaxException {
|
||||
super(string, stringArray);
|
||||
}
|
||||
|
||||
public VirtualPath(String string) throws SyntaxException {
|
||||
super("virtual", string);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user