root/gs2-extensions/tdb-edit/trunk/src/bin/script/TDBClient.pl @ 25402

Revision 25402, 1.8 KB (checked in by jmt12, 9 years ago)

A daemonized, socket-pooled, multithreaded server allowing remote editing of TDB databases. This is for use on clusters or other circumstances where byte-level locking isn't supported (and so multiple writer access to TDB causing exciting issues)

  • Property svn:executable set to *
Line 
1#!/usr/bin/perl
2
3# Setup Environment
4BEGIN
5{
6  die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
7  die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
8
9  unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
10  unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
11  unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/XML/XPath");
12  unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
13  unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
14
15  if (defined $ENV{'GSDLEXTS'})
16  {
17    my @extensions = split(/:/,$ENV{'GSDLEXTS'});
18    foreach my $e (@extensions)
19    {
20      my $ext_prefix = "$ENV{'GSDLHOME'}/ext/$e";
21      unshift (@INC, "$ext_prefix/perllib");
22      unshift (@INC, "$ext_prefix/perllib/cpan");
23      unshift (@INC, "$ext_prefix/perllib/plugins");
24      unshift (@INC, "$ext_prefix/perllib/classify");
25    }
26  }
27  if (defined $ENV{'GSDL3EXTS'})
28  {
29    my @extensions = split(/:/,$ENV{'GSDL3EXTS'});
30    foreach my $e (@extensions)
31    {
32      my $ext_prefix = "$ENV{'GSDL3SRCHOME'}/ext/$e";
33      unshift (@INC, "$ext_prefix/perllib");
34      unshift (@INC, "$ext_prefix/perllib/cpan");
35      unshift (@INC, "$ext_prefix/perllib/plugins");
36      unshift (@INC, "$ext_prefix/perllib/classify");
37    }
38  }
39
40  # Manually installed CPAN package in GEXT*INSTALL
41  unshift (@INC, $ENV{'GEXTPARALLELBUILDING_INSTALLED'} . "/share/perl/5.12.4");
42}
43
44use strict;
45use warnings;
46
47use SocketsSwimmingThreadPoolClient;
48my $port= shift;
49my $message= shift;
50die "Usage: perl client.pl <port> <string>\n" unless defined($message) && defined($port);
51my $c= SocketsSwimmingThreadPoolClient->new(host=>'localhost',
52                                            port=>$port
53                                           );
54print "Contacting server on localhost:$port\n";
55print "Sent: |$message|\n";
56print "Recv: |" . $c->query($message) . "|\n\n";
57exit;
Note: See TracBrowser for help on using the browser.