blob: 70b08ad8dd619ca4166f0eb4fc0dc893f9e01018 [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
Mark Sleec416a272007-03-05 05:40:37 +000020// This autogenerated skeleton file illustrates how to build a server.
21// You should copy it to another filename to avoid overwriting it.
22
23#include "ThreadsTest.h"
Roger Meier49ff8b12012-04-13 09:12:31 +000024#include <thrift/protocol/TBinaryProtocol.h>
25#include <thrift/server/TThreadPoolServer.h>
26#include <thrift/transport/TSocket.h>
27#include <thrift/transport/TTransportUtils.h>
28#include <thrift/concurrency/Monitor.h>
29#include <thrift/concurrency/ThreadManager.h>
30#include <thrift/concurrency/PlatformThreadFactory.h>
Mark Sleec416a272007-03-05 05:40:37 +000031
Mark Slee02d1edc2007-03-07 05:17:25 +000032using boost::shared_ptr;
T Jake Lucianib5e62212009-01-31 22:36:20 +000033using namespace apache::thrift;
34using namespace apache::thrift::protocol;
35using namespace apache::thrift::transport;
36using namespace apache::thrift::server;
37using namespace apache::thrift::concurrency;
Mark Sleec416a272007-03-05 05:40:37 +000038
39int main(int argc, char **argv) {
40 int port = 9090;
41 std::string host = "localhost";
42
43 shared_ptr<TTransport> transport(new TSocket(host, port));
44 shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
45
46 transport->open();
47
48 ThreadsTestClient client(protocol);
49 int val;
50 val = client.threadOne(5);
51 fprintf(stderr, "%d\n", val);
52 val = client.stop();
53 fprintf(stderr, "%d\n", val);
54 val = client.threadTwo(5);
55 fprintf(stderr, "%d\n", val);
56
57 transport->close();
58
59 fprintf(stderr, "done.\n");
60
61 return 0;
62}
63