Search in sources :

Example 1 with AsyncMappable

use of com.dexels.navajo.mapping.AsyncMappable in project navajo by Dexels.

the class AdminMap method getAsyncThreads.

@SuppressWarnings("rawtypes")
public AsyncProxy[] getAsyncThreads() {
    Map all = com.dexels.navajo.mapping.AsyncStore.getInstance().objectStore;
    Iterator iter = all.values().iterator();
    List<AsyncProxy> l = new ArrayList<>();
    while (iter.hasNext()) {
        AsyncMappable am = (AsyncMappable) iter.next();
        Access ac = com.dexels.navajo.mapping.AsyncStore.getInstance().accessStore.get(am.pointer);
        AsyncProxy o = new AsyncProxy();
        o.user = ac.rpcUser;
        o.rpcName = ac.rpcName;
        o.setPointer(am.getPointer());
        o.startDate = am.getStartDate();
        o.name = am.getName();
        o.startTime = am.getStartTime();
        o.running = am.getRunning();
        o.interrupt = am.getInterrupt();
        o.accessId = ac.accessID;
        o.totaltime = (int) (System.currentTimeMillis() - am.getStartDate().getTime());
        o.ipAddress = ac.ipAddress;
        o.host = ac.hostName;
        o.kill = am.kill;
        o.stackTrace = am.getStackTrace();
        o.lockClass = am.getLockClass();
        o.lockName = am.getLockName();
        o.lockOwner = am.getLockOwner();
        o.waiting = am.isWaiting();
        try {
            o.percReady = am.getPercReady();
        } catch (Exception e) {
            logger.error("Error: ", e);
        }
        l.add(o);
    }
    AsyncProxy[] objects = new AsyncProxy[l.size()];
    return l.toArray(objects);
}
Also used : AsyncMappable(com.dexels.navajo.mapping.AsyncMappable) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) Access(com.dexels.navajo.script.api.Access) Map(java.util.Map) UserException(com.dexels.navajo.script.api.UserException) MappableException(com.dexels.navajo.script.api.MappableException)

Example 2 with AsyncMappable

use of com.dexels.navajo.mapping.AsyncMappable in project navajo by Dexels.

the class AsyncProxy method setInterrupt.

public void setInterrupt(boolean b) {
    if (b) {
        Map<String, AsyncMappable> all = com.dexels.navajo.mapping.AsyncStore.getInstance().objectStore;
        Iterator<AsyncMappable> iter = all.values().iterator();
        AsyncMappable am = null;
        boolean found = false;
        while (iter.hasNext() && !found) {
            am = iter.next();
            if (am.getPointer().equals(this.pointer))
                found = true;
        }
        if (am != null) {
            am.interrupt();
        } else {
            logger.warn("Can not interrupt: No AsyncMappable found");
        }
    }
}
Also used : AsyncMappable(com.dexels.navajo.mapping.AsyncMappable)

Example 3 with AsyncMappable

use of com.dexels.navajo.mapping.AsyncMappable in project navajo by Dexels.

the class AsyncProxy method setKill.

public void setKill(boolean b) {
    if (b) {
        Map<String, AsyncMappable> all = com.dexels.navajo.mapping.AsyncStore.getInstance().objectStore;
        Iterator<AsyncMappable> iter = all.values().iterator();
        AsyncMappable am = null;
        boolean found = false;
        while (iter.hasNext() && !found) {
            am = iter.next();
            if (am.getPointer().equals(this.pointer))
                found = true;
        }
        if (am != null) {
            am.stop();
        } else {
            logger.warn("Can not stop: No AsyncMappable found");
        }
        com.dexels.navajo.mapping.AsyncStore.getInstance().removeInstance(pointer);
    }
}
Also used : AsyncMappable(com.dexels.navajo.mapping.AsyncMappable)

Example 4 with AsyncMappable

use of com.dexels.navajo.mapping.AsyncMappable in project navajo by Dexels.

the class AsyncProxy method setResume.

public void setResume(boolean b) {
    if (b) {
        Map<String, AsyncMappable> all = com.dexels.navajo.mapping.AsyncStore.getInstance().objectStore;
        Iterator<AsyncMappable> iter = all.values().iterator();
        AsyncMappable am = null;
        boolean found = false;
        while (iter.hasNext() && !found) {
            am = iter.next();
            if (am.getPointer().equals(this.pointer)) {
                found = true;
            }
        }
        if (am != null) {
            am.resume();
        } else {
            logger.warn("Can not resume: No AsyncMappable found");
        }
    }
}
Also used : AsyncMappable(com.dexels.navajo.mapping.AsyncMappable)

Aggregations

AsyncMappable (com.dexels.navajo.mapping.AsyncMappable)4 Access (com.dexels.navajo.script.api.Access)1 MappableException (com.dexels.navajo.script.api.MappableException)1 UserException (com.dexels.navajo.script.api.UserException)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1