Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Small memory cleanups. #411

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
package com.groupon.seleniumgridextras.grid;

import com.groupon.seleniumgridextras.config.*;

import java.util.LinkedList;
import java.util.List;

public class SessionTracker {

List<String> sessionsRecorded = new LinkedList<String>();
LinkedList<String> sessionsRecorded = new LinkedList<String>();


public void startSession(String session) {
sessionsRecorded.add(session);

// videos to keep, and sessions to keep track of
int videosToKeep
= RuntimeConfig.getConfig().getVideoRecording().getVideosToKeep();
if (videosToKeep > 0
&& sessionsRecorded.size() > videosToKeep)
{
// then forget the first session
sessionsRecorded.remove();
}
}

public List<String> getSessions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ public static BufferedImage convertToType(BufferedImage sourceImage,
else {
image = new BufferedImage(sourceImage.getWidth(),
sourceImage.getHeight(), targetType);
image.getGraphics().drawImage(sourceImage, 0, 0, null);
Graphics g = image.getGraphics();
g.drawImage(sourceImage, 0, 0, null);
g.dispose();
}

return image;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public static BufferedImage createTitleFrame(Dimension dimension, int imageType,
g.setFont(new Font("TimesRoman", Font.PLAIN, 14));
g.drawString("" + line2, firstLineX, secondLineY);
g.drawString("" + line3, firstLineX, thirdLineY);
g.dispose();

return image;
}
Expand Down