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
c94b3630
Commit
c94b3630
authored
Apr 07, 2017
by
Michael Ritter
Browse files
Remove a collection from active maps and trigger a group summary update
parent
688ec119
Changes
2
Hide whitespace changes
Inline
Side-by-side
ace-am/src/main/java/edu/umiacs/ace/monitor/access/CollectionCountContext.java
View file @
c94b3630
...
@@ -44,9 +44,9 @@ import javax.sql.DataSource;
...
@@ -44,9 +44,9 @@ import javax.sql.DataSource;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.locks.Lock
;
import
java.util.concurrent.locks.Lock
;
import
java.util.concurrent.locks.ReentrantLock
;
import
java.util.concurrent.locks.ReentrantLock
;
...
@@ -63,16 +63,16 @@ public class CollectionCountContext implements ServletContextListener {
...
@@ -63,16 +63,16 @@ public class CollectionCountContext implements ServletContextListener {
public
static
final
String
CTX_STARTUP
=
"startup_complete"
;
public
static
final
String
CTX_STARTUP
=
"startup_complete"
;
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
CollectionCountContext
.
class
);
CollectionCountContext
.
class
);
private
static
Map
<
Collection
,
Long
>
fileCountMap
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileCountMap
=
new
Concurrent
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileActiveMap
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileActiveMap
=
new
Concurrent
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileCorruptMap
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileCorruptMap
=
new
Concurrent
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileMissingMap
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileMissingMap
=
new
Concurrent
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileMissingTokenMap
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileMissingTokenMap
=
new
Concurrent
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileTokenMismatchMap
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileTokenMismatchMap
=
new
Concurrent
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
totalErrorMap
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
totalErrorMap
=
new
Concurrent
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
totalSizeMap
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
totalSizeMap
=
new
Concurrent
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileRemoteMissing
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileRemoteMissing
=
new
Concurrent
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileRemoteCorrupt
=
new
HashMap
<>();
private
static
Map
<
Collection
,
Long
>
fileRemoteCorrupt
=
new
Concurrent
HashMap
<>();
private
static
AtomicInteger
totalCollections
=
new
AtomicInteger
(
0
);
private
static
AtomicInteger
totalCollections
=
new
AtomicInteger
(
0
);
private
static
Lock
lock
=
new
ReentrantLock
();
private
static
Lock
lock
=
new
ReentrantLock
();
private
static
boolean
abort
=
false
;
private
static
boolean
abort
=
false
;
...
@@ -217,8 +217,20 @@ public class CollectionCountContext implements ServletContextListener {
...
@@ -217,8 +217,20 @@ public class CollectionCountContext implements ServletContextListener {
totalCollections
.
incrementAndGet
();
totalCollections
.
incrementAndGet
();
}
}
public
static
void
decrementTotalCollections
()
{
public
static
void
decrementTotalCollections
(
Collection
collection
)
{
totalCollections
.
decrementAndGet
();
totalCollections
.
decrementAndGet
();
fileCountMap
.
remove
(
collection
);
fileActiveMap
.
remove
(
collection
);
fileCorruptMap
.
remove
(
collection
);
fileMissingMap
.
remove
(
collection
);
fileMissingTokenMap
.
remove
(
collection
);
fileTokenMismatchMap
.
remove
(
collection
);
totalErrorMap
.
remove
(
collection
);
totalSizeMap
.
remove
(
collection
);
fileRemoteMissing
.
remove
(
collection
);
fileRemoteCorrupt
.
remove
(
collection
);
GroupSummaryContext
.
updateGroup
(
collection
.
getGroup
());
}
}
public
static
int
getTotalCollections
()
{
public
static
int
getTotalCollections
()
{
...
...
ace-am/src/main/java/edu/umiacs/ace/monitor/core/ManageCollectionServlet.java
View file @
c94b3630
...
@@ -96,7 +96,7 @@ public class ManageCollectionServlet extends EntityManagerServlet {
...
@@ -96,7 +96,7 @@ public class ManageCollectionServlet extends EntityManagerServlet {
String
paramCheckResponse
=
null
;
String
paramCheckResponse
=
null
;
/*
*
/*
* Modification, view, or removal of an existing collection
* Modification, view, or removal of an existing collection
* if we have an int, and its > 0, and it is the key for a resource
* if we have an int, and its > 0, and it is the key for a resource
*/
*/
...
@@ -109,16 +109,16 @@ public class ManageCollectionServlet extends EntityManagerServlet {
...
@@ -109,16 +109,16 @@ public class ManageCollectionServlet extends EntityManagerServlet {
}
}
/*
*
/*
* Tst to see if we're removing a collection
* Tst to see if we're removing a collection
*/
*/
if
(!
Strings
.
isEmpty
(
request
.
getParameter
(
PARAM_REMOVE
))
if
(!
Strings
.
isEmpty
(
request
.
getParameter
(
PARAM_REMOVE
))
&&
request
.
getParameter
(
PARAM_REMOVE
).
toLowerCase
().
equals
(
"yes"
))
{
&&
request
.
getParameter
(
PARAM_REMOVE
).
toLowerCase
().
equals
(
"yes"
))
{
LOG
.
debug
(
"removing collection"
+
collection
.
getName
());
LOG
.
debug
(
"removing collection
"
+
collection
.
getName
());
removeCollection
(
em
,
collection
,
storage
);
removeCollection
(
em
,
collection
,
storage
);
response
.
sendRedirect
(
"Status?collectionid=-1"
);
response
.
sendRedirect
(
"Status?collectionid=-1"
);
return
;
return
;
}
/*
*
}
/*
* otherwise, are we updating?
* otherwise, are we updating?
*/
*/
else
if
(
checkParameters
(
request
)
else
if
(
checkParameters
(
request
)
...
@@ -132,7 +132,7 @@ public class ManageCollectionServlet extends EntityManagerServlet {
...
@@ -132,7 +132,7 @@ public class ManageCollectionServlet extends EntityManagerServlet {
}
}
trans
.
commit
();
trans
.
commit
();
dispatcher
=
request
.
getRequestDispatcher
(
"collectionfinish.jsp"
);
dispatcher
=
request
.
getRequestDispatcher
(
"collectionfinish.jsp"
);
}
/*
*
}
/*
* ok, we're just opening an existing collection for modification
* ok, we're just opening an existing collection for modification
* - this should display the storage page since storage will be set
* - this should display the storage page since storage will be set
*/
*/
...
@@ -140,7 +140,7 @@ public class ManageCollectionServlet extends EntityManagerServlet {
...
@@ -140,7 +140,7 @@ public class ManageCollectionServlet extends EntityManagerServlet {
LOG
.
debug
(
"loading existing collection: "
+
collection
.
getName
());
LOG
.
debug
(
"loading existing collection: "
+
collection
.
getName
());
dispatcher
=
request
.
getRequestDispatcher
(
"collectionmodify.jsp"
);
dispatcher
=
request
.
getRequestDispatcher
(
"collectionmodify.jsp"
);
}
}
}
/*
*
}
/*
* its either a new submission, or requesting a blank page.
* its either a new submission, or requesting a blank page.
* We shouldn't set storage information here yet, just create the
* We shouldn't set storage information here yet, just create the
* new collection and create a blank storage
* new collection and create a blank storage
...
@@ -209,7 +209,7 @@ public class ManageCollectionServlet extends EntityManagerServlet {
...
@@ -209,7 +209,7 @@ public class ManageCollectionServlet extends EntityManagerServlet {
storage
.
remove
(
em
);
storage
.
remove
(
em
);
}
}
em
.
remove
(
collection
);
em
.
remove
(
collection
);
CollectionCountContext
.
decrementTotalCollections
();
CollectionCountContext
.
decrementTotalCollections
(
collection
);
trans
.
commit
();
trans
.
commit
();
}
}
...
...
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