Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
2865757c34e36e457d1bcc40f2683ae7570ca83f
[simgrid.git] / org / simgrid / msg / Comm.java
1 package org.simgrid.msg;
2 /**
3 * Copyright 2012 The SimGrid team. All right reserved. 
4 *
5 * This program is free software; you can redistribute 
6 * it and/or modify it under the terms of the license 
7 * (GNU LGPL) which comes with this package.
8 *
9 */
10 /**
11  * Communication action, representing an ongoing communication
12  * between processes.
13  */
14 public class Comm {
15         /**
16          * Represents the bind between the java comm and the
17          * native C comm. You must never access it, since it is 
18          * automatically set.
19          */
20         public long bind = 0;
21         /**
22          * Represents the bind for the task object pointer. Don't touch it.
23          */
24         public long bindTask = 0;
25         /**
26          * Task associated with the comm. Beware, it can be null 
27          */
28         protected Task task = null;
29         /**
30          * Protected constructor, used by Comm factories
31          * in Task.
32          */
33         protected Comm() {
34
35         }
36         /**
37          * Finalize the communication object, destroying it.
38          */
39         protected void finalize() {
40                 unbind();
41         }
42         /**
43          * Unbind the communication object
44          */
45         public native void unbind();
46         /**
47          * Returns if the communication is finished or not.
48          * If the communication has finished and there was an error,
49          * raise an exception.
50          */
51         public native boolean test() throws TransferFailureException, HostFailureException, TimeoutException ;
52         /**
53          * Returns the task associated with the communication.
54          * if the communication isn't finished yet, will return null.
55          */
56         public Task getTask() {
57                 return task;
58         }
59         
60 }