Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
13a82d95
Commit
13a82d95
authored
12 years ago
by
Jean Chalard
Committed by
Kurt Partridge
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Lazy2] Pass a runnable to abort
Change-Id: I721afbf426099753aa876a55323eb806b08c24d6
parent
7423005b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/research/ResearchLog.java
+11
-4
11 additions, 4 deletions
java/src/com/android/inputmethod/research/ResearchLog.java
with
11 additions
and
4 deletions
java/src/com/android/inputmethod/research/ResearchLog.java
+
11
−
4
View file @
13a82d95
...
@@ -98,6 +98,8 @@ public class ResearchLog {
...
@@ -98,6 +98,8 @@ public class ResearchLog {
* output.
* output.
*
*
* See class comment for details about {@code JsonWriter} construction.
* See class comment for details about {@code JsonWriter} construction.
*
* @param onClosed run after the close() operation has completed asynchronously
*/
*/
private
synchronized
void
close
(
final
Runnable
onClosed
)
{
private
synchronized
void
close
(
final
Runnable
onClosed
)
{
mExecutor
.
submit
(
new
Callable
<
Object
>()
{
mExecutor
.
submit
(
new
Callable
<
Object
>()
{
...
@@ -144,8 +146,10 @@ public class ResearchLog {
...
@@ -144,8 +146,10 @@ public class ResearchLog {
/**
/**
* Waits for publication requests to finish, closes the JsonWriter, but then deletes the backing
* Waits for publication requests to finish, closes the JsonWriter, but then deletes the backing
* output file.
* output file.
*
* @param onAbort run after the abort() operation has completed asynchronously
*/
*/
private
synchronized
void
abort
()
{
private
synchronized
void
abort
(
final
Runnable
onAbort
)
{
mExecutor
.
submit
(
new
Callable
<
Object
>()
{
mExecutor
.
submit
(
new
Callable
<
Object
>()
{
@Override
@Override
public
Object
call
()
throws
Exception
{
public
Object
call
()
throws
Exception
{
...
@@ -159,6 +163,9 @@ public class ResearchLog {
...
@@ -159,6 +163,9 @@ public class ResearchLog {
if
(
mFile
!=
null
)
{
if
(
mFile
!=
null
)
{
mFile
.
delete
();
mFile
.
delete
();
}
}
if
(
onAbort
!=
null
)
{
onAbort
.
run
();
}
}
}
return
null
;
return
null
;
}
}
...
@@ -173,7 +180,7 @@ public class ResearchLog {
...
@@ -173,7 +180,7 @@ public class ResearchLog {
* @param timeout time to wait for close in milliseconds
* @param timeout time to wait for close in milliseconds
*/
*/
public
void
blockingAbort
(
final
long
timeout
)
{
public
void
blockingAbort
(
final
long
timeout
)
{
abort
();
abort
(
null
);
awaitTermination
(
timeout
,
TimeUnit
.
MILLISECONDS
);
awaitTermination
(
timeout
,
TimeUnit
.
MILLISECONDS
);
}
}
...
@@ -231,10 +238,10 @@ public class ResearchLog {
...
@@ -231,10 +238,10 @@ public class ResearchLog {
return
null
;
return
null
;
}
}
});
});
}
catch
(
RejectedExecutionException
e
)
{
}
catch
(
final
RejectedExecutionException
e
)
{
// TODO: Add code to record loss of data, and report.
// TODO: Add code to record loss of data, and report.
if
(
DEBUG
)
{
if
(
DEBUG
)
{
Log
.
d
(
TAG
,
"ResearchLog.publish() rejecting scheduled execution"
);
Log
.
d
(
TAG
,
"ResearchLog.publish() rejecting scheduled execution"
,
e
);
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment