Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.

-1
votes
0answers
14 views

What are some design ideas for a data mapping and transformation application?

Here is a high level outline of the project: We frequently need to convert data from a new incoming system to our in house system (sort of a basic ETL process) We would prefer to do this dynamically, ...
0
votes
0answers
20 views

Private/Hiding dependencies between Maven modules

Given three project modules X, Y and Z on a Maven based project, and Y depends of Z and X of Y and X should not know that Y depends of Z, being this: X -> Y Y -> Z X -X> Z What is the best way to ...
1
vote
1answer
42 views

Should this part of my web-app implemented on server-side or client-side?

I want to write an application which monitors a few URLs (like a couple hundred) of all branches of school. By monitoring, we mean that it sends requests to those URLs at regular intervals (Interval ...
0
votes
0answers
10 views

Should I implement a JAX-RS ExceptionMapper for java.lang.Error?

I have a Jersey server that handles REST requests where I've implemented a RuntimeExceptionsMapper implements ExceptionMapper<RuntimeException>. If there's an unexpected exception, it handles it ...
-3
votes
0answers
38 views

How is a Python Lambda function like an anonymous function in Javascript or Java? [on hold]

I've heard that Lambda functions in analogous to an anonymous function in Javascript / Java how is that?
1
vote
2answers
155 views

Calling a method with different parameters and iterate

I have a method that inserts into the Android Calendar an event. You can see a simplified snippet in two steps: 1)declare the variables 2) I put them into a kind of array that in the end will insert ...
1
vote
4answers
373 views

What do OOP languages gain from having constructors that always return an object?

In what seems like a deliberate design decision, C++ does not have a null value for objects and references. This makes using objects and references very elegant since we don't have to perform null ...
0
votes
1answer
56 views

Cache vs DB design decision?

Number of times this question comes to my and my team mind, should we persist or cache the data. I understand some time there is functional requirement that we need to persist in DB. But in my case ...
0
votes
2answers
67 views

Sequential or parallel access to hard disk in multithread program?

In multi threaded java program, I initiate four concurrent threads with below details 1. Thread 1 writing file F1 2. Thread 2 writing file F2 3. Thread 3 reading file F3 4. Thread 4 reading ...
4
votes
3answers
349 views

Resolving circular dependency between two classes

I am trying to resolve a circular dependency between two components in my system. The Messenger component is responsible for sending and receiving messages on a web socket. The Controller component ...
0
votes
0answers
19 views

Edit List attribute in JPA when null?

I am using EclipseLink as my JPA implementation and Postgresql as my DB. JPA: @Struct(name="label,.....") @Entity @Table(name="\"XYZ\"", schema="\"XYZ\"") @NamedQuery(name="...
4
votes
2answers
206 views

Is it violation of single responsibilty to add a method to an existing API

Say i have a Rest API that has a POST and GET method. If i want to overwrite a resource in the API i can call the GET method to get the original item and then call the POST method to replace that ...
0
votes
1answer
80 views

Best approach for web service that calls other web services

The scenario is: client makes request to server A Server A makes potentially multiple requests to server B. Edit to clarify, server A makes the requests concurrently using Futures. Server A blocks ...
-2
votes
0answers
13 views

Java-libPST : merge 2 appointements

I am currently working on PST (here is the library and the doc: http://rjohnsondev.github.io/java-libpst/) The objects I use are PSTAppointement. In an arrayList, I list my objects, some are almost ...
-1
votes
1answer
84 views

Parsing and handling large byte array [closed]

I'm working on a feature in my project, where I have a large array of bytes received. The array has size of 65536 bytes. The structure looks like this: On the beginning there's header with ...
0
votes
0answers
24 views

Java RPC - Notify client without client-side method call

The current project is a basic java web application written with the RPC pattern and java ObjectStream... Here a some base classes used by my basic framework: public abstract class AbstractServer ...
-3
votes
1answer
117 views

Is it fluent interface or what is it?

So, I am a beginner level Java guy and I was following the java 2D game development tutorial on YouTube by CodeNMore. in the States video (https://www.youtube.com/watch?v=871zoXsYrbI&index=11&...
2
votes
1answer
204 views

Java web development

I started to develop web applications not so long ago, and therefore there are a lot of unknown things in this field for me. My question concerns web development using the Java language. Assume that ...
0
votes
1answer
108 views

Simple but frequently throwing vs reasonable but rarely throwing vs complex but never throwing [duplicate]

A lot of code that's designed to convert or parse some data of type Foo into a Bar is written with the assumption that one wouldn't intentionally pass it invalid inputs. As such, it assumes that ...
-1
votes
0answers
65 views

Singleton vs class-with-all-static-fields-methods vs service

I'm writing an application in Android Studio where practically every activity will in one way or another play a sound that's 1-3 seconds long. The activities will contain square images that will play ...
2
votes
3answers
150 views

Try/catch or add exception to method signature for method used by a larger system?

public Path createPath(String name){ return Files.createFile( Paths.get( name ) ); } In createPath(String name), the java.nio.file.Files throws a java.io.IOException. This is however to be used ...
1
vote
0answers
72 views

MVC - How should components inside controller communicate?

I'm developing a level editor in Java. I'm designing its code in MVC. From what I've learned: controllers can have a direct reference (fields) to views and models. Views can have direct reference to ...
0
votes
2answers
121 views

How to build reports for an ecommerce webapp without slowing it down

We have a medium sized ecommerce website which is entirely custom built in using Java and MySQL database on AWS infrastructure. Over a period of past several years, our orders volume has grown ...
3
votes
5answers
189 views

Use POJO or Map when there is a finite number of known keys?

I have some set of data with key-value pairs, but there is only a finite and known set of keys, all of the key should always be present on that data, and they all have the same type for the value. ...
0
votes
2answers
190 views

If I modify a private field using another setter, is it a bad practice?

I have a java class where I have few booleans and one arraylist. If the boolean field is set to true, I need to add it to the arraylist. One of the ways I can do this is to use the setters of each ...
2
votes
2answers
141 views

Number of thread: Computation intensive vs IO intensive operations?

I came across below statement at this blog Computation intensive operations should use a number of threads lower than or equal to the number of cores, while IO intensive operations like copying ...
2
votes
2answers
209 views

Is importing wildcards a bad idea?

If I do this import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; Then why don't I do this, it's more convenient ...
0
votes
1answer
106 views

Post Increment of a variable in brackets [closed]

In my computer science exam there was a question as follows: i=10, j=51 & k=7. p = i+(--k +j) + (3*(i++))+i. I am getting the answer as 111. Here's my methodology : k is decreased by one in (--...
0
votes
0answers
27 views

Migrating from portlet to a different technology

I'm trying to migrate a JBoss Portal Platform 6 application to a monolithic/ deportalized application,with the challenge of doing this change without changing the service/business layer; One of the ...
1
vote
1answer
48 views

Where to store static contents

Recently I am developing a new feature for my web application that must be Release Independent. The feature requires to show some predefined data. Those data will rarely be changed or updated. Here ...
2
votes
0answers
31 views

Chronicle Queue: how to make a stack and how to limit disk usage

My server and several clients are different JVMs running on the same machine, they need to share persisted time series data: server reads a time series from somewhere, writes to a persisted embedded ...
-1
votes
0answers
27 views

Exception handling while waiting for a Promise to be ready?

I am having this issue where I am waiting for a Promise returned by a function, call it foo(), to be ready, however when foo() throws in an exception, the program just "halts". Is there a way around ...
1
vote
0answers
39 views

Seeking Tips on PAAS Architecture

I've developed a java web app using Vaadin, and using Jelastic/MassiveGrid as the PAAS. However, I need advice on proper architecture for my needs. Desired Outcome: Users land on my homepage where ...
0
votes
0answers
43 views

Pulling analytics metrics from java application without code modifications

We use spring 4.3 and spring boot version 1.5 in our java based web application. For (product) analytics purposes we want to read the metadata of our product which is persisted in an RDBMS store (...
-1
votes
0answers
21 views

Why do I need AddDrawerListener to use toggle?

public class MainActivity extends AppCompatActivity { Toolbar toolbar; DrawerLayout drawerLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(...
-1
votes
0answers
48 views

benchmarking a large java algorithm

we are developing and maintaining a large java meta-heuristic algorithm. We have build this completely deterministic to make it easy to track bugs or errors. When adding a new feature we are always ...
8
votes
6answers
963 views

Should reused exceptions types be favored over single use ones?

Let's say I have Doors that are managed by a DoorService. The DoorService is in charge of opening, closing and locking the doors that are stored on the database. public interface DoorService { ...
0
votes
2answers
146 views

if and else or if an return?

I have a Java method with a void type of return that checks a condition. It do something in case of true and other thing in case of false, typical if / else structure, but is possible use only the if ...
0
votes
4answers
155 views

Rest API Design in case of partial success

So I have a ticket booking system. I have ticket booking request on api, from my application we call payment service. If failed on first attempt we proceed by adding message on queue for handling ...
2
votes
1answer
32 views

Gradle/Java separation public private API

I have a project that has a public API and an internal code. The public part is published on MavenCentral. I thought about making a package each, but everything from the 'internal' package that ...
-1
votes
1answer
32 views

Tools for generating a form from a schema, and applying process flow logic

We have a situation where the business has a range of datasets which end users contribute to. The business needs flexibility in adjusting or rather extending these datasets, and also publishing new ...
1
vote
0answers
27 views

How to make rest api end points in swagger UI pre authenticated in Spring BOOT

I have written a spring boot rest API application with OAuth.I have integrated swagger UI for API documentation. I want the API endpoints on swagger UI to be accessible without an access token. Please ...
2
votes
2answers
161 views

Is it an antipattern to introduce complexity into a builder?

I've looked at various definitions of the builder pattern and whilst there's varying definitions, they tend to be focused on the broad definition of incremental construction. However, it seems that ...
0
votes
1answer
383 views

In new project where you have ability to define DB and write app code, what is seen as best practice?

Good day When starting a new project and you have access to the db as well as writing the code. In this specific case it is PostgreSQL and Java EE with JPA and Hibernate. Should one: Aim to ...
1
vote
2answers
48 views

Returning JPA Entities in Rest Api's?

Recently Ive seen so many devs working with the stack Spring/JPA and returning all these JPA entities on their rest controllers. In my opinion it's a BAD PRACTICE for several reason such: ...
0
votes
0answers
25 views

How to architect priority ordered processing between two apps with multiple threads producing/consuming requests?

Apologies if the title of the question is bit misleading. I have two apps X and Y both implemented in java. App X runs in apache servicemix container and Y is web-app running in jee app server (often ...
0
votes
0answers
16 views

Persisting as XML using the model class or create a standalone class

Over the past two years I've written an image sorting and processing program for our lab, using JavaFX. The class Project contains all the information: collections of Images, Tags, Labels etc, as ...
1
vote
0answers
96 views

Why is java's Object toString method defined as it is?

In the Java API specification for the Object class for the toString method, there is the line "It is recommended that all subclasses override this method." While I don't have a better idea for what ...
-1
votes
1answer
128 views

How can I prevent my API from being accessed by anything but my website?

I've got an API (Java + Play Framework). I've got a website (React) who has to communicate with the API. I don't want my API being called by anything but my website. How can I do?
1
vote
0answers
23 views

Does this archicteture work for a Mobile App and Destkop App

This is a proposal of a Distribuited Cloud Architecture for DAWUF which is a Digital Audio Workstation under design and developmente in JAVA, XAMARIN, with REST services The white boxes are the ...