Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
adapt
ace
Commits
9ad490b9
Commit
9ad490b9
authored
Jan 29, 2016
by
Michael Ritter
Browse files
Add field to track the total number of collections
parent
06cc89a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
ace-am/src/main/java/edu/umiacs/ace/monitor/access/CollectionCountContext.java
View file @
9ad490b9
...
...
@@ -30,23 +30,25 @@
// $Id$
package
edu.umiacs.ace.monitor.access
;
import
edu.umiacs.ace.util.PersistUtil
;
import
edu.umiacs.ace.monitor.core.Collection
;
import
edu.umiacs.ace.util.PersistUtil
;
import
edu.umiacs.sql.SQL
;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.NDC
;
import
javax.persistence.EntityManager
;
import
javax.persistence.Query
;
import
javax.servlet.ServletContextEvent
;
import
javax.servlet.ServletContextListener
;
import
javax.sql.DataSource
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.locks.Lock
;
import
java.util.concurrent.locks.ReentrantLock
;
import
javax.persistence.EntityManager
;
import
javax.persistence.Query
;
import
javax.servlet.ServletContextEvent
;
import
javax.servlet.ServletContextListener
;
import
javax.sql.DataSource
;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.NDC
;
/**
* Class to gather a count of all collections at startup.
...
...
@@ -70,6 +72,7 @@ public class CollectionCountContext implements ServletContextListener {
private
static
Map
<
Collection
,
Long
>
totalSizeMap
=
new
HashMap
<
Collection
,
Long
>();
private
static
Map
<
Collection
,
Long
>
fileRemoteMissing
=
new
HashMap
<
Collection
,
Long
>();
private
static
Map
<
Collection
,
Long
>
fileRemoteCorrupt
=
new
HashMap
<
Collection
,
Long
>();
private
static
AtomicInteger
totalCollections
=
new
AtomicInteger
(
0
);
private
static
Lock
lock
=
new
ReentrantLock
();
private
static
boolean
abort
=
false
;
...
...
@@ -99,6 +102,7 @@ public class CollectionCountContext implements ServletContextListener {
return
;
}
queryCollection
((
Collection
)
o
);
incrementTotalCollections
();
}
em
.
close
();
}
catch
(
Exception
e
)
{
...
...
@@ -208,6 +212,18 @@ public class CollectionCountContext implements ServletContextListener {
return
-
1
;
}
public
static
void
incrementTotalCollections
()
{
totalCollections
.
incrementAndGet
();
}
public
static
void
decrementTotalCollections
()
{
totalCollections
.
decrementAndGet
();
}
public
static
int
getTotalCollections
()
{
return
totalCollections
.
get
();
}
/**
* Update statistics for a collection.
*
...
...
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