1 /* Copyright (c) 2012-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 package org.simgrid.msg;
10 * Communication action, representing an ongoing communication
15 * Indicates if the communication is a receiving communication
17 protected boolean receiving;
19 * Indicates if the communication is finished
21 protected boolean finished = false;
23 * Represents the bind between the java comm and the
24 * native C comm. You must never access it, since it is
27 private long bind = 0;
29 * Represents the bind for the task object pointer. Don't touch it.
31 private long taskBind = 0;
33 * Task associated with the comm. Beware, it can be null
35 protected Task task = null;
37 * Protected constructor, used by Comm factories
44 * Finalize the communication object, destroying it.
46 protected void finalize() throws Throwable {
50 * Unbind the communication object
52 protected native void destroy() throws NativeException;
54 * Returns if the communication is finished or not.
55 * If the communication has finished and there was an error,
58 public native boolean test() throws TransferFailureException, HostFailureException, TimeoutException ;
60 * Wait for the complemetion of the communication for an indefinite time
62 public void waitCompletion() throws TransferFailureException, HostFailureException, TimeoutException {
66 * Wait for the completion of the communication.
67 * Throws an exception if there were an error in the communication.
68 * @param timeout Time before giving up
70 public native void waitCompletion(double timeout) throws TransferFailureException, HostFailureException, TimeoutException;
73 * Returns the task associated with the communication.
74 * if the communication isn't finished yet, will return null.
76 public Task getTask() {
81 * Class initializer, to initialize various JNI stuff
83 public static native void nativeInit();