Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge branch '1.6' into integration/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Jun 27, 2012
2 parents f196925 + 3bb2418 commit 7068346
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
14 changes: 8 additions & 6 deletions zanata-war/src/main/java/org/zanata/action/ReindexAsyncBean.java
Expand Up @@ -38,7 +38,9 @@
public class ReindexAsyncBean
{

private static final int BATCH_SIZE = 500;
//TODO make this configurable
private static final int BATCH_SIZE = 5000;

@Logger
private Log log;

Expand Down Expand Up @@ -174,25 +176,25 @@ private void reindex(Class<?> clazz)
ScrollableResults results = null;
try
{
// TODO try this, see how it affects reindexing time:
//session.flushToIndexes();
// session.getSearchFactory().optimize(clazz);

log.info("Setting manual-flush and ignore-cache for {0}", clazz);
session.setFlushMode(FlushMode.MANUAL);
session.setCacheMode(CacheMode.IGNORE);

results = session.createCriteria(clazz).setFetchSize(BATCH_SIZE).scroll(ScrollMode.FORWARD_ONLY);

int index = 0;
results = session.createCriteria(clazz).setFirstResult(index).setMaxResults(BATCH_SIZE).scroll(ScrollMode.FORWARD_ONLY);
while (results.next())
{
objectProgress++;
index++;
session.index(results.get(0)); // index each element
if (index % BATCH_SIZE == 0)
{
log.info("periodic flush and clear for {0} (index {1})", clazz, index);
session.flushToIndexes(); // apply changes to indexes
session.clear(); // clear since the queue is processed
results.close();
results = session.createCriteria(clazz).setFirstResult(index).setMaxResults(BATCH_SIZE).scroll(ScrollMode.FORWARD_ONLY);
}
}
session.flushToIndexes(); // apply changes to indexes
Expand Down
Expand Up @@ -48,17 +48,17 @@ public interface CheckKey
static final int KEY_K = 'K';
static final int KEY_S = 'S';

static int KEY_1 = 49;
static int KEY_1_NUM = 35;
static int KEY_1 = 49; // keycode of number '1' on the top keyboard
static int KEY_1_NUM = 97; // keycode of number '1' in the key pad without modifier

static final int KEY_2 = 50;
static final int KEY_2_NUM = 40;
static final int KEY_2 = 50; // keycode of number '2' on the top keyboard
static final int KEY_2_NUM = 98; // keycode of number '2' in the key pad without modifier

static final int KEY_3 = 51;
static final int KEY_3_NUM = 34;
static final int KEY_3 = 51; // keycode of number '3' on the top keyboard
static final int KEY_3_NUM = 99; // keycode of number '3' in the key pad without modifier

static final int KEY_4 = 52;
static final int KEY_4_NUM = 37;
static final int KEY_4 = 52; // keycode of number '4' on the top keyboard
static final int KEY_4_NUM = 100; // keycode of number '4' in the key pad without modifier

void init(NativeEvent event);

Expand Down Expand Up @@ -99,7 +99,7 @@ public interface CheckKey
boolean isCopyFromSourceKey();

/**
* Copy from translation memory: CTRL+SHIFT+(1/2/3/4)
* Copy from translation memory: CTRL+ALT+(1/2/3/4)
*
*/
boolean isCopyFromTransMem();
Expand Down
Expand Up @@ -170,7 +170,7 @@ public boolean isCtrlKey()
@Override
public boolean isCopyFromTransMem()
{
return ctrlKey && shiftKey && (keyCode == KEY_1 || keyCode == KEY_1_NUM || keyCode == KEY_2 || keyCode == KEY_2_NUM || keyCode == KEY_3 || keyCode == KEY_3_NUM || keyCode == KEY_4 || keyCode == KEY_4_NUM);
return ctrlKey && altKey && (keyCode == KEY_1 || keyCode == KEY_1_NUM || keyCode == KEY_2 || keyCode == KEY_2_NUM || keyCode == KEY_3 || keyCode == KEY_3_NUM || keyCode == KEY_4 || keyCode == KEY_4_NUM);
}

@Override
Expand Down

0 comments on commit 7068346

Please sign in to comment.