Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
b46d89a1
Commit
b46d89a1
authored
Dec 07, 2015
by
Dave Cridland
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #431 from guusdk/OF-992
OF-992: Re-init on restart
parents
001400ed
5a38e194
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
34 deletions
+39
-34
HttpSessionManager.java
...va/org/jivesoftware/openfire/http/HttpSessionManager.java
+39
-34
No files found.
src/java/org/jivesoftware/openfire/http/HttpSessionManager.java
View file @
b46d89a1
...
...
@@ -81,25 +81,37 @@ public class HttpSessionManager {
JiveGlobals
.
migrateProperty
(
"xmpp.httpbind.worker.threads"
);
JiveGlobals
.
migrateProperty
(
"xmpp.httpbind.worker.timeout"
);
}
this
.
sessionManager
=
SessionManager
.
getInstance
();
init
();
/**
* @deprecated As of Openfire 4.0.0, the functionality of this method was added to the implementation of #start().
*/
@Deprecated
public
void
init
()
{}
private
int
getCorePoolSize
(
int
maxPoolSize
)
{
return
(
maxPoolSize
/
4
)+
1
;
}
public
void
init
()
{
Log
.
warn
(
"HttpSessionManager.init() recreate sendPacketPool"
);
// Configure a pooled executor to handle async routing for incoming packets
// with a default size of 16 threads ("xmpp.httpbind.worker.threads"); also
// uses an unbounded task queue and configurable keep-alive (default: 60 secs)
/**
* Starts the services used by the HttpSessionManager.
*
* (Re)creates and configures a pooled executor to handle async routing for incoming packets with a configurable
* (through property "xmpp.httpbind.worker.threads") amount of threads; also uses an unbounded task queue and
* configurable ("xmpp.httpbind.worker.timeout") keep-alive.
*
* Note: Apart from the processing threads configured in this class, the server also uses a threadpool to perform
* the network IO (as configured in ({@link HttpBindManager}). BOSH installations expecting heavy loads may want to
* allocate additional threads to this worker pool to ensure timely delivery of inbound packets
*/
public
void
start
()
{
Log
.
info
(
"Starting instance"
);
// Note: server supports up to 254 client threads by default (@see HttpBindManager)
// BOSH installations expecting heavy loads may want to allocate additional threads
// to this worker pool to ensure timely delivery of inbound packets
this
.
sessionManager
=
SessionManager
.
getInstance
();
int
maxPoolSize
=
JiveGlobals
.
getIntProperty
(
"xmpp.httpbind.worker.threads"
,
// use deprecated property as default (shared with ConnectionManagerImpl)
JiveGlobals
.
getIntProperty
(
"xmpp.client.processing.threads"
,
8
));
int
keepAlive
=
JiveGlobals
.
getIntProperty
(
"xmpp.httpbind.worker.timeout"
,
60
);
final
int
maxClientPoolSize
=
JiveGlobals
.
getIntProperty
(
"xmpp.client.processing.threads"
,
8
);
final
int
maxPoolSize
=
JiveGlobals
.
getIntProperty
(
"xmpp.httpbind.worker.threads"
,
maxClientPoolSize
);
final
int
keepAlive
=
JiveGlobals
.
getIntProperty
(
"xmpp.httpbind.worker.timeout"
,
60
);
sendPacketPool
=
new
ThreadPoolExecutor
(
getCorePoolSize
(
maxPoolSize
),
maxPoolSize
,
keepAlive
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(),
// unbounded task queue
...
...
@@ -113,26 +125,19 @@ public class HttpSessionManager {
return
thread
;
}
});
}
private
int
getCorePoolSize
(
int
maxPoolSize
)
{
return
(
maxPoolSize
/
4
)+
1
;
}
sendPacketPool
.
prestartCoreThread
();
/**
* Starts the services used by the HttpSessionManager.
*/
public
void
start
()
{
// Periodically check for Sessions that need a cleanup.
inactivityTask
=
new
HttpSessionReaper
();
TaskEngine
.
getInstance
().
schedule
(
inactivityTask
,
30
*
JiveConstants
.
SECOND
,
30
*
JiveConstants
.
SECOND
);
sendPacketPool
.
prestartCoreThread
();
TaskEngine
.
getInstance
().
schedule
(
inactivityTask
,
30
*
JiveConstants
.
SECOND
,
30
*
JiveConstants
.
SECOND
);
}
/**
* Stops any services and cleans up any resources used by the HttpSessionManager.
*/
public
void
stop
()
{
Log
.
info
(
"Stopping instance"
);
inactivityTask
.
cancel
();
for
(
HttpSession
session
:
sessionMap
.
values
())
{
session
.
close
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment