line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Elasticsearch::Role::CxnPool::Static; |
2
|
|
|
|
|
|
|
$Elasticsearch::Role::CxnPool::Static::VERSION = '1.05'; |
3
|
25
|
|
|
25
|
|
33524
|
use Moo::Role; |
|
25
|
|
|
|
|
64
|
|
|
25
|
|
|
|
|
254
|
|
4
|
|
|
|
|
|
|
with 'Elasticsearch::Role::CxnPool'; |
5
|
|
|
|
|
|
|
requires 'next_cxn'; |
6
|
|
|
|
|
|
|
|
7
|
25
|
|
|
25
|
|
11339
|
use namespace::clean; |
|
25
|
|
|
|
|
60
|
|
|
25
|
|
|
|
|
178
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#=================================== |
10
|
|
|
|
|
|
|
sub BUILD { |
11
|
|
|
|
|
|
|
#=================================== |
12
|
52
|
|
|
52
|
0
|
1231
|
my $self = shift; |
13
|
52
|
|
|
|
|
143
|
$self->set_cxns( @{ $self->seed_nodes } ); |
|
52
|
|
|
|
|
552
|
|
14
|
52
|
|
|
|
|
378
|
$self->schedule_check; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#=================================== |
18
|
|
|
|
|
|
|
sub schedule_check { |
19
|
|
|
|
|
|
|
#=================================== |
20
|
64
|
|
|
64
|
1
|
450
|
my ($self) = @_; |
21
|
64
|
|
|
|
|
429
|
$self->logger->info("Forcing ping before next use on all live cxns"); |
22
|
64
|
|
|
|
|
14120
|
for my $cxn ( @{ $self->cxns } ) { |
|
64
|
|
|
|
|
348
|
|
23
|
76
|
100
|
|
|
|
441
|
next if $cxn->is_dead; |
24
|
67
|
|
|
|
|
415
|
$self->logger->infof( "Ping [%s] before next request", |
25
|
|
|
|
|
|
|
$cxn->stringify ); |
26
|
67
|
|
|
|
|
7062
|
$cxn->force_ping; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=pod |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=encoding UTF-8 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 NAME |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Elasticsearch::Role::CxnPool::Static - A CxnPool role for connecting to a remote cluster with a static list of nodes. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 VERSION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
version 1.05 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 C<schedule_check()> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$cxn_pool->schedule_check |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Forces a ping on each cxn in L<cxns()|Elasticsearch::Role::CxnPool/cxns()> |
51
|
|
|
|
|
|
|
before the next time that cxn is used for a request. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 AUTHOR |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Clinton Gormley <drtech@cpan.org> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by Elasticsearch BV. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This is free software, licensed under: |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# ABSTRACT: A CxnPool role for connecting to a remote cluster with a static list of nodes. |
70
|
|
|
|
|
|
|
|