Hazelcast C++ Client
ICountDownLatch.h
1 /*
2  * Copyright (c) 2008-2018, 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/proxy/ProxyImpl.h"
21 #include "hazelcast/client/serialization/pimpl/Data.h"
22 #include "hazelcast/client/exception/IException.h"
23 #include <string>
24 #include <stdexcept>
25 
26 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
27 #pragma warning(push)
28 #pragma warning(disable: 4251) //for dll export
29 #endif
30 
31 namespace hazelcast {
32  namespace client {
33 
34  namespace spi {
35  class ClientContext;
36  }
37 
61  class HAZELCAST_API ICountDownLatch : public proxy::ProxyImpl {
62  friend class impl::HazelcastClientInstanceImpl;
63 
64  public:
65 
106  bool await(long timeoutInMillis);
107 
120  void countDown();
121 
127  int getCount();
128 
146  bool trySetCount(int count);
147 
148  private:
149  ICountDownLatch(const std::string &objectName, spi::ClientContext *clientContext);
150 
151  serialization::pimpl::Data key;
152 
153  int partitionId;
154  };
155  }
156 }
157 
158 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
159 #pragma warning(pop)
160 #endif
161 
162 #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:61
Definition: MapEntryView.h:32