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