Esempio n. 1
0
static jdwpTransportError JNICALL
shmemAccept(jdwpTransportEnv* env, jlong acceptTimeout, jlong handshakeTimeout)
{
    jint rc;

    if (connection != NULL) {
        RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_STATE, "already connected");
    }
    if (transport == NULL) {
        RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_STATE, "transport not listening");
    }

    rc = shmemBase_accept(transport, (long)acceptTimeout, &connection);
    if (rc != SYS_OK) {
        if (rc == SYS_TIMEOUT) {
            RETURN_ERROR(JDWPTRANSPORT_ERROR_TIMEOUT, "Timed out waiting for connection");
        } else {
            RETURN_IO_ERROR("failed to accept shared memory connection");
        }
    }

    rc = handshake();
    if (rc != JDWPTRANSPORT_ERROR_NONE) {
        shmemBase_closeConnection(connection);
        connection = NULL;
    }
    return rc;
}
/*
 * Class:     com_sun_tools_jdi_SharedMemoryTransport
 * Method:    accept0
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL Java_com_sun_tools_jdi_SharedMemoryTransport_accept0
  (JNIEnv *env, jobject thisObject, jlong id)
{
    SharedMemoryConnection *connection = NULL;
    SharedMemoryTransport *transport = ID_TO_TRANSPORT(id);
    jint rc = shmemBase_accept(transport, &connection);
    if (rc != SYS_OK) {
        throwShmemException(env, "shmemBase_accept failed", rc);
    }
    return CONNECTION_TO_ID(connection);
}
Esempio n. 3
0
/*
 * Class:     com_sun_tools_jdi_SharedMemoryTransport
 * Method:    accept0
 * Signature: (J)J
 */
JNIEXPORT jlong JNICALL Java_com_sun_tools_jdi_SharedMemoryTransportService_accept0
  (JNIEnv *env, jobject thisObject, jlong id, jlong timeout)
{
    SharedMemoryConnection *connection = NULL;
    SharedMemoryTransport *transport = ID_TO_TRANSPORT(id);
    jint rc;

    rc = shmemBase_accept(transport, (long)timeout, &connection);
    if (rc != SYS_OK) {
	if (rc == SYS_TIMEOUT) {
	    throwException(env, "com/sun/jdi/connect/spi/TransportTimeoutException", 
		"Timed out waiting for target VM to connect");
	} else {
	    throwShmemException(env, "shmemBase_accept failed", rc);
	}
	return -1;
    }
    return CONNECTION_TO_ID(connection);
}