Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Cameo
cameo
Commits
c47890ba
Commit
c47890ba
authored
Dec 10, 2021
by
legoc
Browse files
Changed member name
parent
bc8c2ca7
Changes
2
Hide whitespace changes
Inline
Side-by-side
cameo-api/src/main/java/fr/ill/ics/cameo/base/This.java
View file @
c47890ba
...
...
@@ -15,7 +15,7 @@ import fr.ill.ics.cameo.strings.Endpoint;
public
class
This
{
static
This
i
mpl
;
static
This
i
nstance
;
private
Endpoint
serverEndpoint
;
private
String
name
;
...
...
@@ -142,71 +142,71 @@ public class This {
private
static
Com
com
;
void
initServer
()
{
server
.
registerEventListener
(
i
mpl
.
getEventListener
());
server
.
registerEventListener
(
i
nstance
.
getEventListener
());
if
(
i
mpl
.
getStarterEndpoint
()
!=
null
)
{
starterServer
=
new
Server
(
i
mpl
.
getStarterEndpoint
());
if
(
i
nstance
.
getStarterEndpoint
()
!=
null
)
{
starterServer
=
new
Server
(
i
nstance
.
getStarterEndpoint
());
}
com
=
new
Com
(
i
mpl
.
getServer
(),
i
mpl
.
getId
());
com
=
new
Com
(
i
nstance
.
getServer
(),
i
nstance
.
getId
());
}
static
public
void
init
(
String
[]
args
)
{
i
mpl
=
new
This
(
args
);
i
mpl
.
initServer
();
i
nstance
=
new
This
(
args
);
i
nstance
.
initServer
();
}
static
public
void
init
(
String
name
,
String
endpoint
)
{
i
mpl
=
new
This
(
name
,
endpoint
);
i
mpl
.
initServer
();
i
nstance
=
new
This
(
name
,
endpoint
);
i
nstance
.
initServer
();
}
static
public
String
getName
()
{
if
(
i
mpl
==
null
)
{
if
(
i
nstance
==
null
)
{
return
null
;
}
return
i
mpl
.
name
;
return
i
nstance
.
name
;
}
static
public
int
getId
()
{
if
(
i
mpl
==
null
)
{
if
(
i
nstance
==
null
)
{
return
0
;
}
return
i
mpl
.
id
;
return
i
nstance
.
id
;
}
public
int
getTimeout
()
{
if
(
i
mpl
==
null
)
{
if
(
i
nstance
==
null
)
{
return
0
;
}
return
i
mpl
.
server
.
getTimeout
();
return
i
nstance
.
server
.
getTimeout
();
}
public
void
setTimeout
(
int
timeout
)
{
if
(
i
mpl
==
null
)
{
if
(
i
nstance
==
null
)
{
return
;
}
i
mpl
.
server
.
setTimeout
(
timeout
);
i
nstance
.
server
.
setTimeout
(
timeout
);
}
static
public
Endpoint
getEndpoint
()
{
if
(
i
mpl
==
null
)
{
if
(
i
nstance
==
null
)
{
return
null
;
}
return
i
mpl
.
serverEndpoint
;
return
i
nstance
.
serverEndpoint
;
}
static
public
Server
getServer
()
{
if
(
i
mpl
==
null
)
{
if
(
i
nstance
==
null
)
{
return
null
;
}
return
i
mpl
.
server
;
return
i
nstance
.
server
;
}
static
public
Server
getStarterServer
()
{
if
(
i
mpl
==
null
)
{
if
(
i
nstance
==
null
)
{
return
null
;
}
return
i
mpl
.
starterServer
;
return
i
nstance
.
starterServer
;
}
static
public
Com
getCom
()
{
...
...
@@ -214,10 +214,10 @@ public class This {
}
static
public
boolean
isAvailable
(
int
timeout
)
{
if
(
i
mpl
==
null
)
{
if
(
i
nstance
==
null
)
{
return
false
;
}
return
i
mpl
.
server
.
isAvailable
(
timeout
);
return
i
nstance
.
server
.
isAvailable
(
timeout
);
}
static
public
boolean
isAvailable
()
{
...
...
@@ -225,18 +225,18 @@ public class This {
}
static
public
void
cancelWaitings
()
{
if
(
i
mpl
==
null
)
{
if
(
i
nstance
==
null
)
{
return
;
}
i
mpl
.
waitingSet
.
cancelAll
();
i
nstance
.
waitingSet
.
cancelAll
();
}
static
public
void
terminate
()
{
i
mpl
.
terminateAll
();
i
nstance
.
terminateAll
();
}
static
public
void
setResult
(
byte
[]
data
)
{
JSONObject
response
=
i
mpl
.
server
.
requestJSON
(
Messages
.
createSetResultRequest
(
getId
()),
data
);
JSONObject
response
=
i
nstance
.
server
.
requestJSON
(
Messages
.
createSetResultRequest
(
getId
()),
data
);
int
value
=
JSON
.
getInt
(
response
,
Messages
.
RequestResponse
.
VALUE
);
if
(
value
==
-
1
)
{
...
...
@@ -255,7 +255,7 @@ public class This {
*/
static
public
boolean
setRunning
()
{
JSONObject
request
=
Messages
.
createSetStatusRequest
(
getId
(),
Application
.
State
.
RUNNING
);
JSONObject
response
=
i
mpl
.
server
.
requestJSON
(
request
);
JSONObject
response
=
i
nstance
.
server
.
requestJSON
(
request
);
int
value
=
JSON
.
getInt
(
response
,
Messages
.
RequestResponse
.
VALUE
);
if
(
value
==
-
1
)
{
...
...
@@ -269,7 +269,7 @@ public class This {
* @return
*/
static
public
boolean
isStopping
()
{
return
(
i
mpl
.
getState
(
getId
())
==
Application
.
State
.
STOPPING
);
return
(
i
nstance
.
getState
(
getId
())
==
Application
.
State
.
STOPPING
);
}
/**
...
...
@@ -277,7 +277,7 @@ public class This {
* @param handler
*/
static
public
void
handleStop
(
final
Handler
handler
,
int
stoppingTime
)
{
i
mpl
.
createStopHandler
(
handler
,
stoppingTime
);
i
nstance
.
createStopHandler
(
handler
,
stoppingTime
);
}
/**
...
...
@@ -293,14 +293,14 @@ public class This {
* @return
*/
static
public
Instance
connectToStarter
(
int
options
)
{
if
(
i
mpl
.
starterServer
==
null
)
{
if
(
i
nstance
.
starterServer
==
null
)
{
return
null
;
}
// Iterate the instances to find the id
List
<
Instance
>
instances
=
i
mpl
.
starterServer
.
connectAll
(
i
mpl
.
getStarterName
(),
0
);
List
<
Instance
>
instances
=
i
nstance
.
starterServer
.
connectAll
(
i
nstance
.
getStarterName
(),
0
);
for
(
Instance
i
:
instances
)
{
if
(
i
.
getId
()
==
i
mpl
.
getStarterId
())
{
if
(
i
.
getId
()
==
i
nstance
.
getStarterId
())
{
return
i
;
}
}
...
...
cameo-api/src/main/java/fr/ill/ics/cameo/base/Waiting.java
View file @
c47890ba
...
...
@@ -23,15 +23,15 @@ public abstract class Waiting {
public
void
add
()
{
// Add the waiting if This exists.
if
(
This
.
i
mpl
!=
null
)
{
This
.
i
mpl
.
getWaitingSet
().
add
(
this
);
if
(
This
.
i
nstance
!=
null
)
{
This
.
i
nstance
.
getWaitingSet
().
add
(
this
);
}
}
public
void
remove
()
{
// Remove the waiting if This exists.
if
(
This
.
i
mpl
!=
null
)
{
This
.
i
mpl
.
getWaitingSet
().
remove
(
this
);
if
(
This
.
i
nstance
!=
null
)
{
This
.
i
nstance
.
getWaitingSet
().
remove
(
this
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment