Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
ICountDownLatch.h
1 /*
2  * Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef HAZELCAST_ICOUNT_DOWN_LATCH
17 #define HAZELCAST_ICOUNT_DOWN_LATCH
18 
19 #include "hazelcast/client/spi/ClientContext.h"
20 #include "hazelcast/client/spi/InvocationService.h"
21 #include "hazelcast/client/proxy/ProxyImpl.h"
22 #include "hazelcast/client/serialization/pimpl/Data.h"
23 #include "hazelcast/client/exception/IException.h"
24 #include <string>
25 #include <stdexcept>
26 
27 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
28 #pragma warning(push)
29 #pragma warning(disable: 4251) //for dll export
30 #endif
31 
32 namespace hazelcast {
33  namespace client {
34 
35  namespace spi {
36  class ClientContext;
37  }
38 
62  class HAZELCAST_API ICountDownLatch : public proxy::ProxyImpl {
63  friend class HazelcastClient;
64 
65  public:
66 
107  bool await(long timeoutInMillis);
108 
121  void countDown();
122 
128  int getCount();
129 
147  bool trySetCount(int count);
148 
149  private:
150  ICountDownLatch(const std::string &objectName, spi::ClientContext *clientContext);
151 
152  serialization::pimpl::Data key;
153 
154  int partitionId;
155  };
156  }
157 }
158 
159 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
160 #pragma warning(pop)
161 #endif
162 
163 #endif /* HAZELCAST_ICOUNT_DOWN_LATCH */
ICountDownLatch is a backed-up distributed alternative to the java.util.concurrent.CountDownLatch java.util.concurrent.CountDownLatch.
Definition: ICountDownLatch.h:62
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:412