Search in sources :

Example 1 with JCJavaMonitor

use of com.ibm.dtfj.java.javacore.JCJavaMonitor in project openj9 by eclipse.

the class JavaRuntimeBuilder method addBlockedThread.

/**
 */
public void addBlockedThread(JavaMonitor monitor, long threadID) throws BuilderFailureException {
    JCJavaMonitor jmonitor = (JCJavaMonitor) monitor;
    ImagePointer pointer = fAddressSpace.getPointer(threadID);
    jmonitor.addEnterWaiter(pointer);
}
Also used : ImagePointer(com.ibm.dtfj.image.ImagePointer) JCJavaMonitor(com.ibm.dtfj.java.javacore.JCJavaMonitor)

Example 2 with JCJavaMonitor

use of com.ibm.dtfj.java.javacore.JCJavaMonitor in project openj9 by eclipse.

the class JavaRuntimeBuilder method addWaitOnNotifyThread.

/**
 */
public void addWaitOnNotifyThread(JavaMonitor monitor, long threadID) throws BuilderFailureException {
    JCJavaMonitor jmonitor = (JCJavaMonitor) monitor;
    ImagePointer pointer = fAddressSpace.getPointer(threadID);
    jmonitor.addNotifyWaiter(pointer);
}
Also used : ImagePointer(com.ibm.dtfj.image.ImagePointer) JCJavaMonitor(com.ibm.dtfj.java.javacore.JCJavaMonitor)

Example 3 with JCJavaMonitor

use of com.ibm.dtfj.java.javacore.JCJavaMonitor in project openj9 by eclipse.

the class JavaRuntimeBuilder method addJavaMonitor.

/**
 * Required: monitor ID (throws exception if invalid)
 * <br>
 * Optional: object ID, class name, monitor name, owning thread
 * @return successfully created JavaMonitor
 * @throws BuilderFailureException if an invalid monitor ID is passed.
 */
public JavaMonitor addJavaMonitor(String monitorName, long monitorID, long objectID, String className, long owningThread) throws BuilderFailureException {
    try {
        JCJavaMonitor monitor = getJavaRuntime().findMonitor(monitorID);
        if (monitor == null) {
            ImagePointer pointerMonitorID = fAddressSpace.getPointer(monitorID);
            monitor = new JCJavaMonitor(getJavaRuntime(), pointerMonitorID, monitorName);
        }
        monitor.setOwner(owningThread);
        if (className != null) {
            JCJavaClass jClass = generateJavaClass(getJavaRuntime(), className, IBuilderData.NOT_AVAILABLE);
            /*
				 * Add the object only if the class is also present and object ID is valid.
				 */
            if (jClass != null && fAddressSpace.isValidAddressID(objectID)) {
                ImagePointer pointerObjectID = fAddressSpace.getPointer(objectID);
                JCJavaObject jobject = new JCJavaObject(pointerObjectID, jClass);
                monitor.setObject(jobject);
            }
        }
        return monitor;
    } catch (JCInvalidArgumentsException e) {
        throw new BuilderFailureException(e);
    }
}
Also used : JCJavaObject(com.ibm.dtfj.java.javacore.JCJavaObject) ImagePointer(com.ibm.dtfj.image.ImagePointer) BuilderFailureException(com.ibm.dtfj.javacore.builder.BuilderFailureException) JCInvalidArgumentsException(com.ibm.dtfj.java.javacore.JCInvalidArgumentsException) JCJavaMonitor(com.ibm.dtfj.java.javacore.JCJavaMonitor) JCJavaClass(com.ibm.dtfj.java.javacore.JCJavaClass)

Aggregations

ImagePointer (com.ibm.dtfj.image.ImagePointer)3 JCJavaMonitor (com.ibm.dtfj.java.javacore.JCJavaMonitor)3 JCInvalidArgumentsException (com.ibm.dtfj.java.javacore.JCInvalidArgumentsException)1 JCJavaClass (com.ibm.dtfj.java.javacore.JCJavaClass)1 JCJavaObject (com.ibm.dtfj.java.javacore.JCJavaObject)1 BuilderFailureException (com.ibm.dtfj.javacore.builder.BuilderFailureException)1