equal
deleted
inserted
replaced
60 OS_EXPORT void FunctionServer::stopServer() |
60 OS_EXPORT void FunctionServer::stopServer() |
61 { |
61 { |
62 JELOG2(EUtils); |
62 JELOG2(EUtils); |
63 ScopedLock lock(mMutex); |
63 ScopedLock lock(mMutex); |
64 |
64 |
65 mServerTerminating = true; |
65 if (mOsServer != 0) |
66 if (!mConnectedToClient) |
66 { |
67 { |
67 |
68 mClient.connect(*mOsServer); |
68 mServerTerminating = true; |
69 mConnectedToClient = true; |
69 if (!mConnectedToClient) |
70 } |
70 { |
71 |
71 mClient.connect(*mOsServer); |
72 mClient.sendCloseMessage(this); |
72 mConnectedToClient = true; |
73 mClient.Close(); |
73 } |
74 mMonitor->wait(); |
74 |
|
75 mClient.sendCloseMessage(this); |
|
76 mClient.Close(); |
|
77 mMonitor->wait(); |
|
78 } |
|
79 else |
|
80 { |
|
81 ELOG(EUtils,"FunctionServer::stopServer() called when there was no server running"); |
|
82 } |
75 } |
83 } |
76 |
84 |
77 |
85 |
78 int FunctionServer::doAttachToVm(JavaVM* javaVm, jobject peer) |
86 int FunctionServer::doAttachToVm(JavaVM* javaVm, jobject peer) |
79 { |
87 { |
333 int FunctionServer::executeInServerThread(const Functor& functor) |
341 int FunctionServer::executeInServerThread(const Functor& functor) |
334 { |
342 { |
335 JELOG2(EUtils); |
343 JELOG2(EUtils); |
336 // See stopServerInsideServerThread operation. |
344 // See stopServerInsideServerThread operation. |
337 // ScopedLock lock(mMutex); |
345 // ScopedLock lock(mMutex); |
338 if (mServerTerminating) |
346 if (mServerTerminating || mOsServer == 0) |
339 { |
347 { |
340 std::string message = "Trying to execute code in non-existing FS: "; |
348 std::string message = "Trying to execute code in non-existing FS: "; |
341 message.append(mServerName); |
349 message.append(mServerName); |
|
350 if (mServerTerminating) |
|
351 { |
|
352 message.append(" server closing."); |
|
353 } |
|
354 else |
|
355 { |
|
356 message.append(" server not created."); |
|
357 } |
342 ELOG1(EUtils,"%s", message.c_str()); |
358 ELOG1(EUtils,"%s", message.c_str()); |
343 throw ExceptionBase(message, __FILE__, __FUNCTION__, __LINE__); |
359 throw ExceptionBase(message, __FILE__, __FUNCTION__, __LINE__); |
344 } |
360 } |
345 if (!mConnectedToClient) |
361 if (!mConnectedToClient) |
346 { |
362 { |